aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-09-11 19:45:58 +0800
committerPo Lu2023-09-11 19:45:58 +0800
commit38e96bee1f902dc3d2ca55dd9c4c920c2b75bf2a (patch)
tree6ec85c806b45ce284aeefded50776ac705fbc861 /src
parentf6568dabf2996a1310dad13a2d4cdc197fa2d304 (diff)
downloademacs-38e96bee1f902dc3d2ca55dd9c4c920c2b75bf2a.tar.gz
emacs-38e96bee1f902dc3d2ca55dd9c4c920c2b75bf2a.zip
Provide an option to disable font instruction code execution
* etc/PROBLEMS: Mention instruction code woes and illustrate how to circumvent them. * src/sfntfont.c (sfntfont_setup_interpreter): Respect Vsfnt_uninstructable_family_regexp. (syms_of_sfntfont) <Vsfnt_uninstructable_family_regexp>: New option.
Diffstat (limited to 'src')
-rw-r--r--src/sfntfont.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/sfntfont.c b/src/sfntfont.c
index 64dbffad03f..12fecb32df5 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -2667,6 +2667,18 @@ sfntfont_setup_interpreter (struct sfnt_font_info *info,
2667 struct sfnt_interpreter *interpreter; 2667 struct sfnt_interpreter *interpreter;
2668 const char *error; 2668 const char *error;
2669 struct sfnt_graphics_state state; 2669 struct sfnt_graphics_state state;
2670 Lisp_Object regexp;
2671
2672 /* If Vsfnt_uninstructable_family_regexp matches this font, then
2673 return. */
2674
2675 regexp = Vsfnt_uninstructable_family_regexp;
2676
2677 if (STRINGP (regexp)
2678 && (fast_string_match_ignore_case (regexp,
2679 desc->family)
2680 >= 0))
2681 return;
2670 2682
2671 /* Load the cvt, fpgm and prep already read. */ 2683 /* Load the cvt, fpgm and prep already read. */
2672 2684
@@ -3952,12 +3964,26 @@ syms_of_sfntfont (void)
3952 of the font backend. */ 3964 of the font backend. */
3953 DEFVAR_LISP ("sfnt-default-family-alist", Vsfnt_default_family_alist, 3965 DEFVAR_LISP ("sfnt-default-family-alist", Vsfnt_default_family_alist,
3954 doc: /* Alist between "emulated" and actual font family names. 3966 doc: /* Alist between "emulated" and actual font family names.
3955
3956Much Emacs code assumes that font families named "Monospace" and "Sans 3967Much Emacs code assumes that font families named "Monospace" and "Sans
3957Serif" exist, and map to the default monospace and Sans Serif fonts on 3968Serif" exist, and map to the default monospace and Sans Serif fonts on
3958a system. When the `sfnt' font driver is asked to look for a font 3969a system. When the `sfnt' font driver is asked to look for a font
3959with one of the families in this alist, it uses its value instead. */); 3970with one of the families in this alist, it uses its value instead. */);
3960 Vsfnt_default_family_alist = Qnil; 3971 Vsfnt_default_family_alist = Qnil;
3972
3973 DEFVAR_LISP ("sfnt-uninstructable-family-regexp",
3974 Vsfnt_uninstructable_family_regexp,
3975 doc: /* Regexp matching font families whose glyphs must not be instructed.
3976If nil, instruction code supplied by all fonts will be executed. This
3977variable takes effect when a font entity is opened, not after, and
3978therefore won't affect the scaling of realized faces until their
3979frames' font caches are cleared (see `clear-font-cache').
3980
3981TrueType fonts incorporate instruction code executed to fit each glyph
3982to a pixel grid, so as to improve the visual fidelity of each glyph by
3983eliminating artifacts and chance effects consequent upon the direct
3984upscaling of glyph outline data. Instruction code is occasionally
3985incompatible with Emacs and must be disregarded. */);
3986 Vsfnt_uninstructable_family_regexp = Qnil;
3961} 3987}
3962 3988
3963void 3989void