diff options
| author | Po Lu | 2023-01-11 16:06:15 +0800 |
|---|---|---|
| committer | Po Lu | 2023-01-11 16:06:15 +0800 |
| commit | 494bedde3235f9034746c977260bbbc2c1e51d8c (patch) | |
| tree | 90d75e89eafb04bda28cb667969593dca6ee151c /src/alloc.c | |
| parent | 4c09b9a5a655870a9146dd5af4af12a6ff17d125 (diff) | |
| download | emacs-494bedde3235f9034746c977260bbbc2c1e51d8c.tar.gz emacs-494bedde3235f9034746c977260bbbc2c1e51d8c.zip | |
Bring up the sfnt-android font driver
* configure.ac (ANDROID_CFLAGS): Add sfnt-related font objects
to ANDROID_OBJ when not building stubs.
* lisp/startup.el (android-fonts-enumerated): New variable.
(normal-top-level): Set it. Also enumerate fonts as early as
possible upon startup.
* src/alloc.c (cleanup_vector): Only finalize Android font
entities.
(garbage_collect): Mark sfntfont.c.
* src/android.c (struct android_emacs_drawable): New field
`damage_rect'.
(android_init_emacs_drawable): Initialize
Lorg/gnu/emacs/EmacsDrawable;#damageRect(Landroid/graphics/rect;)V.
(android_create_gc): Initialize cached GC fields.
(android_free_gc): Free cached GC clip rectangles.
(android_change_gc): Cache fields as appropriate.
(android_set_clip_rectangles): Set cached clip rectangles for
easy access from C.
(android_get_gc_values): Use cached values.
(android_get_image): Remove obsolete comment.
(android_lock_bitmap, android_damage_window): New functions that
don't parallel anything on X.
* src/android.h: Update prototypes.
* src/androidfns.c (android_default_font_parameter): Set Droid
Sans Mono as the default monospace font.
(Fx_create_frame): Register the sfntfont driver.
* src/androidgui.h (struct android_gc): Add C side caches for
clip rectangles and the foreground and background colors.
* src/androidterm.h: Update prototypes.
* src/dispextern.h (struct gui_box): New struct.
(gui_union_rectangles): New function.
* src/emacs.c (android_emacs_init): Initialize Android font
stuff late.
* src/font.c (font_make_entity): Clear `is_android' field on
Android.
(font_make_entity_android): Set `is_android' field.
* src/font.h (struct font_entity): New field `is_android'.
* src/print.c (print_vectorlike): Don't print private data,
which could include Lisp_Misc.
* src/sfnt.c (sfnt_read_cmap_format_0, sfnt_read_cmap_format_2)
(sfnt_read_cmap_format_4, sfnt_read_cmap_format_6)
(sfnt_read_cmap_format_8, sfnt_read_cmap_format_12): Remove
buggy pragmas.
(sfnt_lookup_glyph_4_1): New function.
(sfnt_lookup_glyph_4): Handle malformed lookup tables found on
Android.
(sfnt_lookup_glyph): Fix overflow problems in glyph checks.
(sfnt_read_glyph): Handle empty glyphs. This implements some
behavior which everyone else seems to as well, but I can't find
documented in the TrueType Reference Manual.
(sfnt_free_glyph): Export correctly.
(sfnt_transform_coordinates): Make faster.
(sfnt_lerp_half): Fix lerping in some cases.
(sfnt_decompose_glyph): Handle empty glyphs correctly. Close
contours manually instead of waiting for the edge building
process to do that. This lets curves be handled correctly.
(struct sfnt_build_glyph_outline_context): Move internal struct
back to sfnt.c.
(sfnt_build_append): Fix detection of initial entry.
(sfnt_curve_to_and_build_1): Fix De Casteljau implementation.
(sfnt_curve_to_and_build): Use fixed point arithmetic to scale
outlines.
(sfnt_build_glyph_outline): Clear reference counts. Use fixed
point arithmetic.
(sfnt_prepare_raster): Align rasters to 4 bytes,
SFNT_POLY_ALIGNMENT. Fix calculation of offx and offy.
(sfnt_step_edge_by): Step edge by previously computed step_x.
(sfnt_build_outline_edges): Adjust for already closed contours.
Ignore edges abandoned after grid fit. Also precompute step_x
to avoid multiplication on each span rastered.
(sfnt_poly_edges): Improve alignment.
(sfnt_fill_span): Rewrite to avoid control flow in while loop.
(sfnt_poly_span): Remove unnecessary code.
(sfnt_raster_glyph_outline): Use raster stride instead of width.
(sfnt_test_edge, sfnt_test_raster, main): Improve debugging
code.
* src/sfnt.h (struct sfnt_glyph_outline): Add refcount field to
outline.
(struct sfnt_build_glyph_outline_context): Remove private
struct.
(struct sfnt_raster): Add refcount field to raster.
(struct sfnt_edge): Improve doc. Add `source_x' field used when
built with TEST.
(SFNT_CEIL_FIXED): New macro.
* src/sfntfont-android.c (sfntfont_android_saturate32)
(sfntfont_android_scale32, sfntfont_android_mul8x2)
(sfntfont_android_blend, U255TO256)
(sfntfont_android_composite_bitmap, sfntfont_android_union_boxes)
(sfntfont_android_put_glyphs, sfntfont_android_get_cache): New
functions.
(android_sfntfont_driver): New font driver.
(Fandroid_enumerate_fonts): New function.
(syms_of_sfntfont_android_for_pdumper, init_sfntfont_android)
(syms_of_sfntfont_android): Initialize default fonts, special
family mapping and font driver.
* src/sfntfont.c (struct sfnt_font_desc): New fields
`char_cache', `cmap_invalid' and `subtable'.
(sfnt_setup_coding_system): Improve commentary. Add default
branch. Fix return value.
(sfnt_safe_encode_coding_object_1)
(sfnt_safe_encode_coding_object_2):
(sfnt_safe_encode_coding_object): Use decode_coding_object
instead of encode_coding_object.
(sfnt_decode_font_string): Adjust for rename.
(sfnt_decode_foundry_name): New function.
(sfnt_weight_descriptions, sfnt_slant_descriptions)
(sfnt_width_descriptions): Fix definitions.
(sfnt_parse_style): Make function work.
(sfnt_enum_font): Initialize designer, char-cache and subtable
platform ID.
(sfntfont_charset_for_name, mark_sfntfont)
(sfntfont_charset_for_cmap): New functions.
(syms_of_sfntfont): New variable `sfnt-default-family-alist'.
* src/sfntfont.h (_SFNTFONT_H_): Update prototypes.
* src/xdisp.c (gui_union_rectangles): New function.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c index 65a49108d86..86e019b931b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -50,6 +50,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 50 | #include TERM_HEADER | 50 | #include TERM_HEADER |
| 51 | #endif /* HAVE_WINDOW_SYSTEM */ | 51 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 52 | 52 | ||
| 53 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY | ||
| 54 | #include "sfntfont.h" | ||
| 55 | #endif | ||
| 56 | |||
| 53 | #ifdef HAVE_TREE_SITTER | 57 | #ifdef HAVE_TREE_SITTER |
| 54 | #include "treesit.h" | 58 | #include "treesit.h" |
| 55 | #endif | 59 | #endif |
| @@ -3346,8 +3350,9 @@ cleanup_vector (struct Lisp_Vector *vector) | |||
| 3346 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY | 3350 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY |
| 3347 | /* The Android font driver needs the ability to associate extra | 3351 | /* The Android font driver needs the ability to associate extra |
| 3348 | information with font entities. */ | 3352 | information with font entities. */ |
| 3349 | if ((vector->header.size & PSEUDOVECTOR_SIZE_MASK) | 3353 | if (((vector->header.size & PSEUDOVECTOR_SIZE_MASK) |
| 3350 | == FONT_ENTITY_MAX) | 3354 | == FONT_ENTITY_MAX) |
| 3355 | && PSEUDOVEC_STRUCT (vector, font_entity)->is_android) | ||
| 3351 | android_finalize_font_entity (PSEUDOVEC_STRUCT (vector, font_entity)); | 3356 | android_finalize_font_entity (PSEUDOVEC_STRUCT (vector, font_entity)); |
| 3352 | #endif | 3357 | #endif |
| 3353 | } | 3358 | } |
| @@ -6477,6 +6482,9 @@ garbage_collect (void) | |||
| 6477 | 6482 | ||
| 6478 | #ifdef HAVE_ANDROID | 6483 | #ifdef HAVE_ANDROID |
| 6479 | mark_androidterm (); | 6484 | mark_androidterm (); |
| 6485 | #ifndef ANDROID_STUBIFY | ||
| 6486 | mark_sfntfont (); | ||
| 6487 | #endif | ||
| 6480 | #endif | 6488 | #endif |
| 6481 | 6489 | ||
| 6482 | #ifdef HAVE_NS | 6490 | #ifdef HAVE_NS |