1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtfont.C |
2 | * File: rxvtfont.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
4 | * Copyright (c) 2003-2008 Marc Lehmann <pcg@goof.com> |
5 | * - original version. |
5 | * - original version. |
6 | * |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
9 | * the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | *---------------------------------------------------------------------*/ |
20 | *---------------------------------------------------------------------*/ |
21 | |
21 | |
22 | #include "../config.h" |
22 | #include "../config.h" |
23 | #include "rxvt.h" |
23 | #include "rxvt.h" |
24 | #include "rxvtlib.h" |
|
|
25 | #include "rxvtutil.h" |
24 | #include "rxvtutil.h" |
26 | #include "rxvtfont.h" |
25 | #include "rxvtfont.h" |
27 | |
26 | |
28 | #include <cstdlib> |
27 | #include <cstdlib> |
29 | |
28 | |
… | |
… | |
80 | |
79 | |
81 | // japanese |
80 | // japanese |
82 | #if ENCODING_JP || ENCODING_JP_EXT |
81 | #if ENCODING_JP || ENCODING_JP_EXT |
83 | # if XFT |
82 | # if XFT |
84 | // prefer xft for complex scripts |
83 | // prefer xft for complex scripts |
|
|
84 | { CS_JIS0208_1990_0, "xft:Sazanami Mincho:antialias=false" }, |
85 | { CS_JIS0208_1990_0, "xft:Kochi Gothic:antialias=false" }, |
85 | { CS_JIS0208_1990_0, "xft:Kochi Gothic:antialias=false" }, |
86 | { CS_JIS0208_1990_0, "xft:Sazanami Mincho:antialias=false" }, |
|
|
87 | { CS_JIS0208_1990_0, "xft:Mincho:antialias=false" }, |
86 | { CS_JIS0208_1990_0, "xft:Mincho:antialias=false" }, |
88 | { CS_JIS0208_1990_0, "xft::lang=ja:antialias=false" }, |
87 | { CS_JIS0208_1990_0, "xft::lang=ja:antialias=false" }, |
89 | # endif |
88 | # endif |
90 | { CS_JIS0201_1976_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0201*-0" }, |
89 | { CS_JIS0201_1976_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0201*-0" }, |
91 | { CS_JIS0208_1990_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0208*-0" }, |
90 | { CS_JIS0208_1990_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0208*-0" }, |
… | |
… | |
217 | : name(0), width(rxvt_fontprop::unset), height(rxvt_fontprop::unset) |
216 | : name(0), width(rxvt_fontprop::unset), height(rxvt_fontprop::unset) |
218 | { |
217 | { |
219 | } |
218 | } |
220 | |
219 | |
221 | void |
220 | void |
222 | rxvt_font::set_name (char *name) |
221 | rxvt_font::set_name (char *name_) |
223 | { |
222 | { |
224 | if (this->name == name) |
223 | if (name == name_) |
225 | return; |
224 | return; |
226 | |
225 | |
227 | if (this->name) free (this->name); // let the compiler optimize |
226 | if (name) free (name); // let the compiler optimize |
228 | this->name = name; |
227 | name = name_; |
229 | } |
228 | } |
230 | |
229 | |
231 | void |
230 | void |
232 | rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const |
231 | rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const |
233 | { |
232 | { |
… | |
… | |
237 | if (color == Color_bg || color == Color_transparent) |
236 | if (color == Color_bg || color == Color_transparent) |
238 | XClearArea (disp, d, x, y, w, h, false); |
237 | XClearArea (disp, d, x, y, w, h, false); |
239 | else if (color >= 0) |
238 | else if (color >= 0) |
240 | { |
239 | { |
241 | #if XFT |
240 | #if XFT |
242 | bool done = false; |
241 | Picture dst; |
|
|
242 | |
243 | #ifdef HAVE_BG_PIXMAP |
243 | # ifdef HAVE_BG_PIXMAP |
244 | if (term->bgPixmap.pixmap && color >= 0 && term->pix_colors[color].c.color.alpha < 0x0ff00) |
244 | if (term->bgPixmap.pixmap |
245 | { |
245 | && !term->pix_colors[color].is_opaque () |
246 | Picture dst = XftDrawPicture (d); |
246 | && ((dst = XftDrawPicture (d)))) |
247 | if (dst != 0) |
|
|
248 | { |
247 | { |
249 | XClearArea (disp, d, x, y, w, h, false); |
248 | XClearArea (disp, d, x, y, w, h, false); |
|
|
249 | |
250 | Picture solid_color_pict = XftDrawSrcPicture (d, &term->pix_colors[color].c); |
250 | Picture solid_color_pict = XftDrawSrcPicture (d, &term->pix_colors[color].c); |
251 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, x, y, w, h); |
251 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, x, y, w, h); |
252 | done = true; |
|
|
253 | } |
252 | } |
254 | } |
253 | else |
255 | #endif |
254 | # endif |
256 | if (!done) |
|
|
257 | XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); |
255 | XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); |
|
|
256 | |
258 | #else |
257 | #else |
259 | XSetForeground (disp, gc, term->pix_colors[color]); |
258 | XSetForeground (disp, gc, term->pix_colors[color]); |
260 | XFillRectangle (disp, d, gc, x, y, w, h); |
259 | XFillRectangle (disp, d, gc, x, y, w, h); |
261 | #endif |
260 | #endif |
262 | } |
261 | } |
… | |
… | |
500 | |
499 | |
501 | void draw (rxvt_drawable &d, int x, int y, |
500 | void draw (rxvt_drawable &d, int x, int y, |
502 | const text_t *text, int len, |
501 | const text_t *text, int len, |
503 | int fg, int bg); |
502 | int fg, int bg); |
504 | |
503 | |
505 | bool slow; // wether this is a proportional font or has other funny characteristics |
504 | bool slow; // whether this is a proportional font or has other funny characteristics |
506 | XFontStruct *f; |
505 | XFontStruct *f; |
507 | bool enc2b, encm; |
506 | bool enc2b, encm; |
508 | |
507 | |
509 | char *get_property (XFontStruct *f, Atom property, const char *repl) const; |
508 | char *get_property (XFontStruct *f, Atom property, const char *repl) const; |
510 | bool set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth); |
509 | bool set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth); |
… | |
… | |
632 | |
631 | |
633 | if (slashes >= 13 && (!old || *field == old)) |
632 | if (slashes >= 13 && (!old || *field == old)) |
634 | { |
633 | { |
635 | size_t len = field - name; |
634 | size_t len = field - name; |
636 | *ptr = (char *)malloc (len + strlen (replace) + strlen (end) + 1); |
635 | *ptr = (char *)malloc (len + strlen (replace) + strlen (end) + 1); |
637 | strncpy (*ptr, name, len); |
636 | memcpy (*ptr, name, len); |
638 | strcpy (*ptr + len, replace); |
637 | strcpy (*ptr + len, replace); |
639 | strcat (*ptr, end); |
638 | strcat (*ptr, end); |
640 | |
639 | |
641 | return true; |
640 | return true; |
642 | } |
641 | } |
… | |
… | |
793 | return false; |
792 | return false; |
794 | |
793 | |
795 | char *registry = get_property (f, term->xa [XA_CHARSET_REGISTRY], 0); |
794 | char *registry = get_property (f, term->xa [XA_CHARSET_REGISTRY], 0); |
796 | char *encoding = get_property (f, term->xa [XA_CHARSET_ENCODING], 0); |
795 | char *encoding = get_property (f, term->xa [XA_CHARSET_ENCODING], 0); |
797 | |
796 | |
|
|
797 | cs = CS_UNKNOWN; |
|
|
798 | |
798 | if (registry && encoding) |
799 | if (registry && encoding) |
799 | { |
800 | { |
800 | char charset[64]; |
801 | char charset[64]; |
801 | snprintf (charset, 64, "%s-%s", registry, encoding); |
802 | snprintf (charset, 64, "%s-%s", registry, encoding); |
802 | |
803 | |
803 | cs = codeset_from_name (charset); |
804 | cs = codeset_from_name (charset); |
|
|
805 | |
|
|
806 | if (cs == CS_UNKNOWN) |
|
|
807 | rxvt_warn ("%s: cannot deduce encoding from registry/encoding properties \"%s\", ignoring font.\n", name, charset); |
804 | } |
808 | } |
805 | else |
809 | |
|
|
810 | free (registry); |
|
|
811 | free (encoding); |
|
|
812 | |
|
|
813 | if (cs == CS_UNKNOWN) |
806 | { |
814 | { |
807 | const char *charset = get_property (f, XA_FONT, 0); |
815 | const char *charset = get_property (f, XA_FONT, 0); |
808 | |
816 | |
809 | if (!charset) |
817 | if (!charset) |
810 | charset = name; |
818 | charset = name; |
… | |
… | |
813 | while (*charset) |
821 | while (*charset) |
814 | if (*charset++ == '-' && !--count) |
822 | if (*charset++ == '-' && !--count) |
815 | break; |
823 | break; |
816 | |
824 | |
817 | cs = codeset_from_name (charset); |
825 | cs = codeset_from_name (charset); |
|
|
826 | if (cs == CS_UNKNOWN) |
|
|
827 | rxvt_warn ("%s: cannot deduce encoding from font name property \"%s\", ignoring font.\n", name, charset); |
|
|
828 | } |
|
|
829 | |
|
|
830 | if (cs == CS_UNKNOWN) |
818 | } |
831 | { |
819 | |
832 | clear (); |
820 | free (registry); |
833 | return false; |
821 | free (encoding); |
834 | } |
822 | |
835 | |
823 | if (cs == CS_UNICODE) |
836 | if (cs == CS_UNICODE) |
824 | cs = CS_UNICODE_16; // X11 can have a max. of 65536 chars per font |
837 | cs = CS_UNICODE_16; // X11 can have a max. of 65536 chars per font |
825 | |
838 | |
826 | encm = f->min_byte1 != 0 || f->max_byte1 != 0; |
839 | encm = f->min_byte1 != 0 || f->max_byte1 != 0; |
… | |
… | |
873 | if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; |
886 | if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; |
874 | |
887 | |
875 | if (width < g.width) width = g.width; |
888 | if (width < g.width) width = g.width; |
876 | } |
889 | } |
877 | |
890 | |
878 | if (cs == CS_UNKNOWN) |
891 | #if 0 // do it per-character |
|
|
892 | if (prop && width > prop->width) |
879 | { |
893 | { |
880 | fprintf (stderr, "unable to deduce codeset, ignoring font '%s'\n", name); |
|
|
881 | |
|
|
882 | clear (); |
894 | clear (); |
883 | return false; |
895 | return false; |
884 | } |
896 | } |
885 | |
|
|
886 | #if 0 // do it per-character |
|
|
887 | if (prop && width > prop->width) |
|
|
888 | { |
|
|
889 | clear (); |
|
|
890 | return false; |
|
|
891 | } |
|
|
892 | #endif |
897 | #endif |
893 | |
898 | |
894 | return true; |
899 | return true; |
895 | } |
900 | } |
896 | |
901 | |
… | |
… | |
910 | uint32_t ch = FROM_UNICODE (cs, unicode); |
915 | uint32_t ch = FROM_UNICODE (cs, unicode); |
911 | |
916 | |
912 | if (ch == NOCHAR) |
917 | if (ch == NOCHAR) |
913 | return false; |
918 | return false; |
914 | |
919 | |
915 | /* check wether the character exists in _this_ font. horrible. */ |
920 | /* check whether the character exists in _this_ font. horrible. */ |
916 | XCharStruct *xcs; |
921 | XCharStruct *xcs; |
917 | |
922 | |
918 | if (encm) |
923 | if (encm) |
919 | { |
924 | { |
920 | unsigned char byte1 = ch >> 8; |
925 | unsigned char byte1 = ch >> 8; |
… | |
… | |
950 | return false; |
955 | return false; |
951 | |
956 | |
952 | if (!prop || prop->width == rxvt_fontprop::unset) |
957 | if (!prop || prop->width == rxvt_fontprop::unset) |
953 | return true; |
958 | return true; |
954 | |
959 | |
955 | // check wether character overlaps previous/next character |
960 | // check whether character overlaps previous/next character |
956 | int w = xcs->rbearing - xcs->lbearing; |
961 | int w = xcs->rbearing - xcs->lbearing; |
957 | int wcw = max (WCWIDTH (unicode), 1); |
962 | int wcw = max (WCWIDTH (unicode), 1); |
958 | |
963 | |
959 | careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw; |
964 | careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw; |
960 | |
965 | |
… | |
… | |
1134 | FcPatternAddInteger (p, FC_SLANT, prop.slant); |
1139 | FcPatternAddInteger (p, FC_SLANT, prop.slant); |
1135 | |
1140 | |
1136 | #if 0 // clipping unfortunately destroys our precious double-width-characters |
1141 | #if 0 // clipping unfortunately destroys our precious double-width-characters |
1137 | // clip width, we can't do better, or can we? |
1142 | // clip width, we can't do better, or can we? |
1138 | if (FcPatternGet (p, FC_CHAR_WIDTH, 0, &v) != FcResultMatch) |
1143 | if (FcPatternGet (p, FC_CHAR_WIDTH, 0, &v) != FcResultMatch) |
1139 | FcPatternAddInteger (p, FC_CHAR_WIDTH, prop->width); |
1144 | FcPatternAddInteger (p, FC_CHAR_WIDTH, prop.width); |
1140 | #endif |
1145 | #endif |
1141 | |
1146 | |
1142 | if (FcPatternGet (p, FC_MINSPACE, 0, &v) != FcResultMatch) |
1147 | if (FcPatternGet (p, FC_MINSPACE, 0, &v) != FcResultMatch) |
1143 | FcPatternAddBool (p, FC_MINSPACE, 1); |
1148 | FcPatternAddBool (p, FC_MINSPACE, 1); |
1144 | |
1149 | |
… | |
… | |
1288 | rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, |
1293 | rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, |
1289 | const text_t *text, int len, |
1294 | const text_t *text, int len, |
1290 | int fg, int bg) |
1295 | int fg, int bg) |
1291 | { |
1296 | { |
1292 | XGlyphInfo extents; |
1297 | XGlyphInfo extents; |
1293 | XftGlyphSpec *enc = (XftGlyphSpec *)rxvt_temp_buf (len * sizeof (XftGlyphSpec)); |
1298 | XftGlyphSpec *enc = rxvt_temp_buf<XftGlyphSpec> (len); |
1294 | XftGlyphSpec *ep = enc; |
1299 | XftGlyphSpec *ep = enc; |
1295 | |
1300 | |
1296 | dTermDisplay; |
1301 | dTermDisplay; |
1297 | dTermGC; |
1302 | dTermGC; |
1298 | |
1303 | |
1299 | int w = term->fwidth * len; |
1304 | int w = term->fwidth * len; |
1300 | int h = term->fheight; |
1305 | int h = term->fheight; |
1301 | |
1306 | |
1302 | /* TODO: this logic needs some more thinking, since we no longer do pseudo-transparency. |
1307 | bool buffered = bg >= Color_transparent |
1303 | * Maybe make buffering into a resource flag? Compile time option doesn't seems like a |
1308 | && term->option (Opt_buffered); |
1304 | * good idea from the perspective of packaging for wide variety of user configs. |
1309 | |
1305 | */ |
|
|
1306 | bool buffered = true |
|
|
1307 | #ifdef FORCE_UNBUFFERED_XFT |
|
|
1308 | && bg >= 0 |
|
|
1309 | #endif |
|
|
1310 | ; |
|
|
1311 | // cut trailing spaces |
1310 | // cut trailing spaces |
1312 | while (len && text [len - 1] == ' ') |
1311 | while (len && text [len - 1] == ' ') |
1313 | len--; |
1312 | len--; |
1314 | |
1313 | |
1315 | int x_ = buffered ? 0 : x; |
1314 | int x_ = buffered ? 0 : x; |
… | |
… | |
1341 | x_ += cwidth; |
1340 | x_ += cwidth; |
1342 | } |
1341 | } |
1343 | |
1342 | |
1344 | if (buffered) |
1343 | if (buffered) |
1345 | { |
1344 | { |
1346 | bool back_rendered = false; |
|
|
1347 | if (ep != enc) |
1345 | if (ep != enc) |
1348 | { |
1346 | { |
1349 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1347 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1350 | |
1348 | |
1351 | #ifdef HAVE_BG_PIXMAP |
1349 | #ifdef HAVE_BG_PIXMAP |
|
|
1350 | Picture dst = 0; // the only assignment is done conditionally in the following if condition |
|
|
1351 | |
1352 | if (term->bgPixmap.pixmap) |
1352 | if (term->bgPixmap.pixmap |
|
|
1353 | && (bg == Color_transparent || bg == Color_bg |
|
|
1354 | || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) |
1353 | { |
1355 | { |
1354 | Picture dst = 0; |
1356 | int src_x = x, src_y = y; |
1355 | |
1357 | |
1356 | if (bg >= 0 && term->pix_colors[bg].c.color.alpha < 0x0ff00) |
1358 | if (term->bgPixmap.is_parentOrigin ()) |
1357 | dst = XftDrawPicture (d2); |
|
|
1358 | |
|
|
1359 | if (bg < 0 || dst != 0) |
|
|
1360 | { |
1359 | { |
1361 | int src_x = x, src_y = y ; |
|
|
1362 | |
|
|
1363 | if (term->bgPixmap.is_parentOrigin ()) |
|
|
1364 | { |
|
|
1365 | src_x += term->window_vt_x; |
1360 | src_x += term->window_vt_x; |
1366 | src_y += term->window_vt_y; |
1361 | src_y += term->window_vt_y; |
1367 | } |
1362 | } |
1368 | |
1363 | |
1369 | if (term->bgPixmap.pmap_width >= src_x+w |
1364 | if (term->bgPixmap.pmap_width >= src_x + w |
1370 | && term->bgPixmap.pmap_height >= src_y+h) |
1365 | && term->bgPixmap.pmap_height >= src_y + h) |
1371 | { |
1366 | { |
1372 | XCopyArea (disp, term->bgPixmap.pixmap, d2, gc, |
1367 | XCopyArea (disp, term->bgPixmap.pixmap, d2, gc, |
1373 | src_x, src_y, w, h, 0, 0); |
1368 | src_x, src_y, w, h, 0, 0); |
1374 | } |
1369 | } |
1375 | else |
1370 | else |
1376 | { |
1371 | { |
1377 | XGCValues gcv; |
1372 | XGCValues gcv; |
1378 | |
1373 | |
1379 | gcv.fill_style = FillTiled; |
1374 | gcv.fill_style = FillTiled; |
1380 | gcv.tile = term->bgPixmap.pixmap; |
1375 | gcv.tile = term->bgPixmap.pixmap; |
1381 | gcv.ts_x_origin = -src_x; |
1376 | gcv.ts_x_origin = -src_x; |
1382 | gcv.ts_y_origin = -src_y; |
1377 | gcv.ts_y_origin = -src_y; |
1383 | |
1378 | |
1384 | XChangeGC (disp, gc, |
1379 | XChangeGC (disp, gc, |
1385 | GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, |
1380 | GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, |
1386 | &gcv); |
1381 | &gcv); |
1387 | |
1382 | |
1388 | XFillRectangle (disp, d2, gc, 0, 0, w, h); |
1383 | XFillRectangle (disp, d2, gc, 0, 0, w, h); |
1389 | |
1384 | |
1390 | gcv.fill_style = FillSolid; |
1385 | gcv.fill_style = FillSolid; |
1391 | XChangeGC (disp, gc, GCFillStyle, &gcv); |
1386 | XChangeGC (disp, gc, GCFillStyle, &gcv); |
1392 | } |
1387 | } |
1393 | |
1388 | |
1394 | if (bg >= 0) |
1389 | if (dst) |
1395 | { |
1390 | { |
1396 | Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c); |
1391 | Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c); |
|
|
1392 | |
|
|
1393 | // dst can only be set when bg >= 0 |
1397 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
1394 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
1398 | } |
|
|
1399 | |
|
|
1400 | back_rendered = true; |
|
|
1401 | } |
1395 | } |
1402 | } |
1396 | } |
|
|
1397 | else |
1403 | #endif |
1398 | #endif |
1404 | |
|
|
1405 | if (bg >= 0 && !back_rendered) |
|
|
1406 | XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); |
1399 | XftDrawRect (d2, &term->pix_colors[bg >= 0 ? bg : Color_bg].c, 0, 0, w, h); |
1407 | |
1400 | |
1408 | XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); |
1401 | XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); |
1409 | XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); |
1402 | XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); |
1410 | } |
1403 | } |
1411 | else |
1404 | else |
… | |
… | |
1533 | if (!end) |
1526 | if (!end) |
1534 | end = desc + strlen (desc); |
1527 | end = desc + strlen (desc); |
1535 | |
1528 | |
1536 | if (end - desc < 511) |
1529 | if (end - desc < 511) |
1537 | { |
1530 | { |
1538 | strncpy (buf, desc, end - desc); |
1531 | memcpy (buf, desc, end - desc); |
1539 | buf[end - desc] = 0; |
1532 | buf[end - desc] = 0; |
1540 | |
1533 | |
1541 | fonts.push_back (new_font (buf, cs)); |
1534 | fonts.push_back (new_font (buf, cs)); |
1542 | } |
1535 | } |
1543 | else |
1536 | else |
… | |
… | |
1682 | FcPatternDestroy (match); |
1675 | FcPatternDestroy (match); |
1683 | |
1676 | |
1684 | if (find_font (font) < 0) |
1677 | if (find_font (font) < 0) |
1685 | { |
1678 | { |
1686 | char fontname[4096]; |
1679 | char fontname[4096]; |
1687 | sprintf (fontname, "xft:%-.4090s", font); |
1680 | snprintf (fontname, sizeof (fontname), "xft:%s", font); |
1688 | |
1681 | |
1689 | fonts.push_back (new_font (fontname, CS_UNICODE)); |
1682 | fonts.push_back (new_font (fontname, CS_UNICODE)); |
1690 | } |
1683 | } |
1691 | |
1684 | |
1692 | free (font); |
1685 | free (font); |
… | |
… | |
1716 | } |
1709 | } |
1717 | |
1710 | |
1718 | return i; |
1711 | return i; |
1719 | } |
1712 | } |
1720 | |
1713 | |
1721 | |
|
|
1722 | |
|
|