summaryrefslogtreecommitdiff
path: root/src/sfntfont.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-12-18 11:10:40 +0800
committerPo Lu <luangruo@yahoo.com>2023-12-18 11:10:40 +0800
commit103f36cced37eed1bb51cd704b0a64b42f7b8144 (patch)
tree78a4e477432cfedd53f007ceb95823c93f4b8079 /src/sfntfont.c
parent678a594f4f3ddd24a46253d77237580fe4db9fc1 (diff)
downloademacs-103f36cced37eed1bb51cd704b0a64b42f7b8144.tar.gz
Enable the new font scaler
* src/sfnt.c (sfnt_curve_is_flat): Tighten threshold for flat curves. (sfnt_insert_raster_step): Rewrite loop for clarity. (sfnt_poly_set_steps): New function; fill small spans with a plain unexceptional loop rather than memset. (sfnt_poly_steps): Call that function. (sfnt_verbose, main): Adjust tests such that the scaler can be selected at runtime. * src/sfnt.h: Update prototypes. * src/sfntfont.c (sfntfont_get_glyph_raster) (syms_of_sfntfont) <sfnt_raster_glyphs_exactly>: New variable.
Diffstat (limited to 'src/sfntfont.c')
-rw-r--r--src/sfntfont.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/sfntfont.c b/src/sfntfont.c
index f002712dc10..0a8797bfb3b 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -2444,7 +2444,11 @@ sfntfont_get_glyph_raster (sfnt_glyph glyph_code,
}
/* Not already cached. Raster the outline. */
- raster = sfnt_raster_glyph_outline (outline);
+
+ if (!sfnt_raster_glyphs_exactly)
+ raster = sfnt_raster_glyph_outline (outline);
+ else
+ raster = sfnt_raster_glyph_outline_exact (outline);
if (!raster)
return NULL;
@@ -4116,6 +4120,13 @@ eliminating artifacts and chance effects consequent upon the direct
upscaling of glyph outline data. Instruction code is occasionally
incompatible with Emacs and must be disregarded. */);
Vsfnt_uninstructable_family_regexp = Qnil;
+
+ DEFVAR_BOOL ("sfnt-raster-glyphs-exactly", sfnt_raster_glyphs_exactly,
+ doc: /* How font glyph outlines should be converted to graphics.
+If non-nil, glyphs will be displayed in a more precise manner, at the
+cost of performance on devices where floating-point math operations
+are slow. */);
+ sfnt_raster_glyphs_exactly = true;
}
void