| 1802 | |
| 1803 | #ifdef ENHANCED_SYMBOLS |
| 1804 | static void |
| 1805 | X11_set_map_font(struct xwindow *wp) |
| 1806 | { |
| 1807 | struct map_info_t *map_info = wp->map_information; |
| 1808 | XFontStruct *fs; |
| 1809 | Atom font_atom; |
| 1810 | const char *font_name; |
| 1811 | unsigned dashes; |
| 1812 | const char *p; |
| 1813 | size_t len; |
| 1814 | char unicode_font[BUFSZ]; |
| 1815 | Font font_id; |
| 1816 | |
| 1817 | /* Query the configured font for the map */ |
| 1818 | fs = WindowFontStruct(wp->w); |
| 1819 | map_info->text_map.font = fs; |
| 1820 | if (!XGetFontProperty(fs, XA_FONT, &font_atom)) { |
| 1821 | return; |
| 1822 | } |
| 1823 | font_name = XGetAtomName(XtDisplay(wp->w), font_atom); |
| 1824 | if (font_name == NULL) { |
| 1825 | return; |
| 1826 | } |
| 1827 | |
| 1828 | /* Proceed to the registry name */ |
| 1829 | dashes = 13; |
| 1830 | p = font_name; |
| 1831 | while (dashes != 0) { |
| 1832 | const char *q = strchr(p, '-'); |
| 1833 | if (q == NULL) { |
| 1834 | break; |
| 1835 | } |
| 1836 | p = q + 1; |
| 1837 | --dashes; |
| 1838 | } |
| 1839 | |
| 1840 | /* Substitute "iso10646-1" for the registry name and encoding */ |
| 1841 | len = (size_t) (p - font_name); |
| 1842 | if (dashes != 0 || len + 11 > sizeof(unicode_font)) { |
| 1843 | return; |
| 1844 | } |
| 1845 | |
| 1846 | memcpy(unicode_font, font_name, len); |
| 1847 | strcpy(unicode_font + len, "iso10646-1"); |
| 1848 | font_name = unicode_font; |
| 1849 | |
| 1850 | font_id = XLoadFont(XtDisplay(wp->w), font_name); |
| 1851 | map_info->text_map.font = XQueryFont(XtDisplay(wp->w), font_id); |
| 1852 | if (map_info->text_map.font == NULL) { |
| 1853 | /* Fallback in case no iso10646 */ |
| 1854 | map_info->text_map.font = fs; |
| 1855 | } |
| 1856 | } |
| 1857 | #endif |
| 1858 | |
| 1859 | static Font |
no test coverage detected