summaryrefslogtreecommitdiff
path: root/src/sfntfont.c
Commit message (Collapse)AuthorAge
* Fix building the SFNT font driverPo Lu2024-03-30
| | | | | * src/sfntfont.c (sfntfont_list, sfntfont_list_family): Update calls to Fsort for the new calling convention.
* Set adstyle within sfnt font objectsPo Lu2024-02-09
| | | | | * src/sfntfont.c (sfntfont_open): Don't incorrectly clear desc->adstyle.
* Properly sort results for partial font specsPo Lu2024-01-13
| | | | | | * src/sfntfont.c (sfntfont_compare_font_entities): New function. (sfntfont_list): Sort matching font entities by the number of fields set, and mention why.
* ; Add 2024 to copyright yearsPo Lu2024-01-02
|
* Obey USE_MY_METRICS in compound glyphsPo Lu2023-12-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/sfnt.c (struct sfnt_compound_glyph_context): New fields holding the positions of both phantom points. (sfnt_decompose_compound_glyph): New argument METRICS_RETURN; return the metrics of components with USE_MY_METRICS within this field. (sfnt_decompose_glyph): New argument METRICS_RETURN, which serves the same purpose. (sfnt_build_glyph_outline): Apply glyph advance and origin distortion to METRICS, and return the metrics as altered by compound glyphs in there. (sfnt_lookup_glyph_metrics): Trim away two unused parameters, PIXEL_SIZE and HEAD, whose functionality has been superseeded by sfnt_scale_metrics and the implicit scaling the interpreter performs. (sfnt_interpret_compound_glyph_2): Save phantom points within fields provided to that end in CONTEXT. (sfnt_interpret_compound_glyph_1): Save and source phantom points for each glyph to and from the context. (sfnt_test_get_metrics, main): Adjust tests correspondingly. * src/sfnt.h: Update prototypes. * src/sfntfont.c (sfntfont_get_metrics): Remove obsolete parameters. (sfntfont_get_glyph_outline): Don't change temp by the metrics distortions, which is now the task of sfnt_decompose_glyph.
* Consistently round glyph advances in the SFNT font backendPo Lu2023-12-26
| | | | | | | | | | | * src/sfnt.h (SFNT_ROUND_FIXED): New macro. * src/sfntfont.c (sfntfont_get_glyph_outline): Don't apply advance width distortion before the glyph is instructed or decomposed. Round advance width as measured between both phantom points subsequent to instruction code execution. (sfntfont_draw): Don't take the advance's ceiling when advancing origin point.
* Apply TTF advance width rounding to uninstructed glyphsPo Lu2023-12-25
| | | | | | | | | * src/sfnt.c (sfnt_scale_metrics): * src/sfntfont.c (sfntfont_get_glyph_outline): Round advance and floor lbearing scaling glyph metrics. (sfntfont_measure_pcm): Don't round or truncate metrics which have already been.
* Respect glyph metrics modified by instruction codePo Lu2023-12-23
| | | | | | | | | | | | | | | | | | | | * src/sfnt.c (sfnt_read_glyph): Clear advance and origin distortion returning an empty glyph. (sfnt_build_instructed_outline): New parameter *ADVANCE_WIDTH, in which the glyph's advance width is saved. (sfnt_interpret_compound_glyph_1): Refine commentary. (sfnt_verbose, main): Adjust tests. * src/sfnt.h: Update prototypes correspondingly. * src/sfntfont.c (sfntfont_get_glyph_outline): If an instructed outline is available, derive the advance and lbearing from the measurements within. (sfntfont_probe_widths): Call sfntfont_measure_pcm to establish average widths. (sfntfont_open): Do so after instruction code initialization completes. (sfntfont_measure_pcm): Revise commentary.
* Further corrections to font scalingPo Lu2023-12-19
| | | | | | | | | | | * src/sfnt.c (sfnt_dot_fix_14): Correct typo in final division. (sfnt_compute_phantom_points): New parameters S1 and S2, into which unrounded phantom point coordinates are saved. (sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_2) (sfnt_interpret_compound_glyph_1): Adjust correspondingly. * src/sfntfont.c (sfntfont_get_glyph_outline): Delete redundant branch.
* Enable the new font scalerPo Lu2023-12-18
| | | | | | | | | | | | | | | | * 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.
* ; Fix typosStefan Kangas2023-12-10
|
* Save more information into Android font namesPo Lu2023-11-21
| | | | | | * src/sfntfont.c (sfntfont_open): Besides just the font file name, also store the interpreter state, UPEM, charset and instance number in FONT_FULLNAME_INDEX.
* Round underline position and thicknessPo Lu2023-11-03
| | | | | | * src/sfntfont.c (sfntfont_open): Round underline thickness instead of truncating it, as is proper according to several inquiries.
* Don't round underline metricsPo Lu2023-10-31
| | | | | * src/sfntfont.c (sfntfont_open): Don't round underline position or thickness, much as the other font drivers don't either.
* Extract underline positions from PostScript metrics tablesPo Lu2023-10-31
| | | | | | | | | * src/sfntfont.c (struct sfnt_font_desc): Introduce fields where the font's underline position is recorded. (sfnt_enum_font_1): Compute the underline position with information in the post table whenever it exists. (sfntfont_open): Scale the recorded position and save it into the font object.
* Ascertain font spacing from post table if presentPo Lu2023-10-30
| | | | | | | | | | | | | | | * src/sfnt.c (sfnt_table_names): Introduce name of post table. (sfnt_read_post_table): New function. (main): New tests. * src/sfnt.h (struct sfnt_post_table): New struct. * src/sfntfont.c (sfnt_enum_font_1): Read post table, and set spacing from its is_fixed_pitch value. (sfntfont_list_1): Compare spacing between both fonts if supplied in the font spec. (sfntfont_open): Set FONT_FILE_INDEX as well as FONT_FULLNAME_INDEX.
* Enumerate default UVS glyphsPo Lu2023-10-22
| | | | | | | | | | | | | * src/sfnt.c (sfnt_compare_unicode_value_range) (sfnt_is_character_default): New functions. (sfnt_test_uvs): Print and verify the default UVS table. * src/sfnt.h: Update prototypes. * src/sfntfont.c (sfntfont_get_variation_glyphs): Index the cmap with the default glyph, and insert it within VARIATIONS if character is present within a selector record's default UVS table.
* Mollify compiler under Android builds without mmapPo Lu2023-10-18
| | | | | * src/sfntfont.c (sfnt_close_tables, sfnt_open_tables) [!HAVE_MMAP]: Do not declare rc for munmap or mmap.
* Update Android portPo Lu2023-09-30
| | | | | | | | * src/androidmenu.c (android_menu_show): Properly encode pane names before deriving Java strings from them. * src/sfntfont.c (sfnt_parse_style, sfntfont_list_1): Intern adstyles.
* Correct comparisons between size_t and ssize_tPo Lu2023-09-23
| | | | | | | | | | | | | | | | | | * src/sfnt.c (sfnt_read_table_directory, 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, sfnt_read_cmap_format_14) (sfnt_read_cmap_table_1, sfnt_read_cmap_table) (sfnt_read_head_table, sfnt_read_hhea_table, sfnt_read_maxp_table) (sfnt_read_glyf_table, sfnt_read_hmtx_table, sfnt_read_name_table) (sfnt_read_meta_table, sfnt_read_ttc_header) (sfnt_read_default_uvs_table, sfnt_read_nondefault_uvs_table) (sfnt_read_fvar_table, sfnt_read_gvar_table, sfnt_read_avar_table) (sfnt_read_cvar_table, sfnt_read_OS_2_table): * src/sfntfont.c (sfnt_enum_font): Revise code written with only signed `long' in mind to properly compare size_t values with ssize_t.
* ; * src/sfntfont.c (sfntfont_list_family): Remove unused variable.Po Lu2023-09-16
|
* Update Android portPo Lu2023-09-16
| | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsContextMenu.java (display): Return false if the list of menu buttons is empty, lest Android cease displaying menus on the assumption that Emacs is defective. * java/org/gnu/emacs/EmacsView.java (popupMenu): Likewise. * src/fns.c (sort_list): Render sentence motion commands functional within commentary * src/sfntfont.c (sfntfont_list_family): Sort and deduplicate the returned family list and make it a list of symbols. (syms_of_sfntfont) <Qstring_lessp>: New defsym.
* Exclude ``regular'' from font adstylePo Lu2023-09-13
| | | | | * src/sfntfont.c (sfnt_parse_style): Disregard tokens matching Regular entirely.
* Extract font foundry metadata from the OS/2 tablePo Lu2023-09-12
| | | | | | | | | | | | | | | | * src/sfnt.c (sfnt_table_names): Append an entry for OS/2 tables. (sfnt_read_OS_2_table): New function. (main): Introduce a new test for the OS/2 table reader. * src/sfnt.h (sfnt_read_OS_2_table): New declaration. * src/sfntfont.c (sfnt_decode_foundry_name): Delete function. (sfnt_enum_font_1): Read the font's OS/2 table and extract the foundry name from there. Use `misc' if absent. (sfntfont_desc_to_entity, sfntfont_open): Cease interning desc->designer, as that is now a symbol. (syms_of_sfntfont) <Qmisc>: New defsym Qmisc. (bug#65865)
* Provide an option to disable font instruction code executionPo Lu2023-09-11
| | | | | | | | | | * 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.
* Respect vertical centering preferences under AndroidPo Lu2023-09-11
| | | | | | * src/sfntfont.c (sfntfont_open): Match XLFD name against Vvertical_centering_font_regexp; if they agree, set font->vertical_centering. Also set a suitable full name.
* Update Android portPo Lu2023-09-10
| | | | | | * src/sfntfont.c (sfntfont_probe_widths): Prevent widths of glyphs representing control characters from affecting the average width.
* Permit XLFD names to exceed 255 charactersPo Lu2023-09-08
| | | | | | | | | | | | | | | | | | | | | | * doc/lispref/display.texi (Low-Level Font) <font-xlfd-name>: Document new argument `long-xlfds'. * etc/NEWS: Mention removal of XLFD length restrictions. * src/font.c (font_build_object): Dynamically allocate XLFD, permitting them to surpass 255 characters in length. (font_parse_xlfd_1): Cease rejecting XLFDs more than 255 characters in length. (font_dynamic_unparse_xlfd): New function. Like font_unparse_xlfd, but allocate the XLFD dynamically. (font_delete_unmatched): Dynamically allocate XLFD if necessary. (Ffont_xlfd_name): New arg LONG_XLFDs. If t, return a dynamically allocated XLFD. All callers changed. * src/font.h: Update prototypes. * src/fontset.c (Fnew_fontset): Dynamically allocate XLFD when establishing fontset name.
* Properly detect medium fontsPo Lu2023-08-24
| | | | | * src/sfntfont.c (sfnt_decode_family_style): Refer to the preferred family and subfamily if present.
* Properly enumerate GX fonts of the same family with divergent stylesPo Lu2023-08-21
| | | | | | | | | | | | * doc/emacs/android.texi (Android Fonts): Revise explanation of GX font replacement during font enumeration. * src/sfntfont.c (sfnt_replace_fonts_p): If PREV and DESC are of the same family and both are GX fonts, restrict actions taken to removing duplicate styles from PREV. Reported by a user who tried to install GX versions of Cascadia Mono, which are distributed as two files providing the bold and italic variation axes respectively.
* Update Android portPo Lu2023-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/sfnt.c (sfnt_decompose_compound_glyph): New argument GET_METRICS. Call this function to retrieve glyph metrics used to compute phantom points when a component glyph's anchor point is one. (sfnt_decompose_glyph, sfnt_build_glyph_outline): Plumb GET_METRICS these two functions. (sfnt_interpret_shc): Don't shift the provided reference point. (sfnt_transform_f26dot6): Eschew looping through X and Y if no offsets are provided. (sfnt_interpret_compound_glyph_2): Discontinue initializing phantom points here. (sfnt_interpret_compound_glyph_1): Do not incorporate phantom points into the ultimately produced glyph outline. Correctly provide for phantom childanchor points. (sfnt_test_get_metrics, main): Update tests. * src/sfnt.h: Update prototypes. * src/sfntfont.c (struct sfntfont_get_glyph_outline_dcontext): New fields `hmtx', `hhea' and `maxp'. (sfntfont_get_metrics): New function. (sfntfont_get_glyph_outline): Provide new tables and the new callback function.
* ; Fix FSF address in some files' copyright noticesPo Lu2023-08-13
| | | | | | | | | | * src/sfnt.c: * src/sfnt.h: * src/sfntfont-android.c: * src/sfntfont.c: * src/sfntfont.h: Replace the old FSF address with a link to gnu.org/licenses. These addresses were inadvertently imported when sfnt.c was copied to src.
* Merge from origin/emacs-29Eli Zaretskii2023-08-12
| | | | | | | | | | | | | | | | 4767f5eaeed Better fix for bug#65156 dd1d8414b33 Fix insert-file-contents with pipes and /dev/stdin 50649a6d1a2 ; * etc/PROBLEMS: Fix wording. f0dda682ffb ; * etc/NEWS.28: Add deletion of levents.el. f4acae842c0 Fix bug#65042 e1874c4e8bf * configure.ac (HAVE_TREE_SITTER): Set NEED_DYNLIB=yes (b... ef8838c3a5f * etc/NEWS: Mention tramp-show-ad-hoc-proxies. 495bee253fc * test/lisp/net/tramp-tests.el (tramp-test42-utf8): Skip ... de1effd73b4 ; Fix last change 7c7966862bc * test/lisp/net/tramp-tests.el (tramp-test10-write-region... 16205e8db65 ; Improve help-echo in package.el a95e7006989 ; Filter packages available for upgrade via menu bar adff72dd1d2 Fix reverting Rmail buffers
* Uniformly verify sfnt_read_table_directory doesn't return TTC headerPo Lu2023-08-10
| | | | | | * src/sfntfont.c (sfnt_enum_font, sfntfont_read_cmap) (sfnt_open_tables): Check for -1 return value from sfnt_read_table_directory.
* Fix crash when reading TTC font for glyph mapping table selectionPo Lu2023-08-10
| | | | | | | * src/sfnt.c (sfnt_read_cmap_table): Seek to the table directory if DESC->offset is provided. * src/sfntfont.c (sfntfont_read_cmap): Accurately verify cmap subtable header size. (bug#65185)
* Update Android portPo Lu2023-07-31
| | | | | * src/sfnt.c (ISECT): Micro-optimize this instruction. * src/sfntfont.c (sfnt_parse_style): Avoid GC safety problem.
* ; Update Android portPo Lu2023-07-31
| | | | * src/sfntfont.c (sfnt_parse_style): Fix misworded commentary.
* Fix build with Lisp_Object type checkingPo Lu2023-05-31
| | | | | | | | | | | | | | | | * configure.ac: Pass through `--enable-check-lisp-object-type' on Android. * src/alloc.c (android_make_lisp_symbol): * src/android.c: * src/androidfns.c (android_set_no_focus_on_map) (android_set_no_accept_focus): * src/androidfont.c (androidfont_match, androidfont_open_font): * src/androidselect.c (Fandroid_get_clipboard) (Fandroid_get_clipboard_targets): * src/keyboard.c (make_lispy_event, syms_of_keyboard): * src/sfntfont.c (sfnt_enum_font_1, sfntfont_list_1): * src/textconv.c (really_set_point_and_mark): Fix Lisp_Object and integer screw-ups.
* Tweak outline cache stuffPo Lu2023-03-30
| | | | * src/sfntfont.c: Adjust font cache size constants.
* Update Android portPo Lu2023-03-30
| | | | | | | | | | | | | | | | | | * src/sfnt.c (sfnt_make_interpreter): New argument `fvar'. Set axis count. (SCANCTRL): Implement selector bit 8. (GXAXIS): New instruction. (SFVTPV): Validate graphics state after changing freedom vector. (sfnt_line_to_vector): Implement `original'. (sfnt_move): Remove redundant division. (sfnt_interpret_run): Implement distortable font related GXAXIS instruction (0x91). (sfnt_vary_interpreter): Set naxis and norm_coords. (sfnt_make_test_interpreter, pushb_test_args, pushw_test_args) (sfnt_name_instruction, main): Adjust accordingly. * src/sfnt.h (struct sfnt_interpreter, PROTOTYPE): * src/sfntfont.c (sfntfont_setup_interpreter, sfntfont_open): Set up distortion information.
* Improve rules for enumerating user fontsPo Lu2023-03-29
| | | | | | | * doc/emacs/android.texi (Android Fonts): Document distortable font replacement rules. * src/sfntfont.c (sfnt_replace_fonts_p): New function. (sfnt_enum_font_1): Call it.
* Update Android portPo Lu2023-03-29
| | | | | * src/sfntfont.c (sfntfont_setup_interpreter): Don't create interpreter for blatently broken fonts.
* Update Android portPo Lu2023-03-29
| | | | | * src/sfntfont.c (sfntfont_open): Avoid specifying redundant blends.
* Update Android portPo Lu2023-03-28
| | | | | | | * src/sfnt.c (sfnt_vary_compound_glyph): * src/sfntfont.c (sfntfont_get_glyph) (sfntfont_get_glyph_outline): Avoid clobbering offset size flag when varying compound glyph.
* Update Android portPo Lu2023-03-28
| | | | | | | * src/sfnt.c (sfnt_vary_simple_glyph, sfnt_vary_compound_glyph): Fix application of intermediate tuples. * src/sfntfont.c (sfntfont_open): Set xlfd name after applying distortion.
* Correctly round lbearing valuesPo Lu2023-03-28
| | | | | | * src/sfnt.h (SFNT_ROUND_FIXED): * src/sfntfont.c (sfntfont_probe_widths): (sfntfont_measure_pcm): Round lbearing properly.
* Update Android portPo Lu2023-03-28
| | | | | * src/sfntfont.c (sfnt_open_tables): Fix typos in non-HarfBuzz code.
* Update Android portPo Lu2023-03-28
| | | | | | | | | | | | | | | * src/androidterm.c (android_draw_image_glyph_string): Restore potentially clobbered GC clipping. * src/sfnt.c (sfnt_large_integer_add, sfnt_multiply_divide_round) (sfnt_mul_fixed_round): New functions. (sfnt_build_glyph_outline): Take unscaled glyph metrics. (sfnt_prepare_raster, sfnt_vary_simple_glyph) (sfnt_vary_compound_glyph, sfnt_vary_interpreter): Use rounding multiplication to scale deltas. (main): Adjust tests. * src/sfntfont.c (sfntfont_get_glyph_outline) (sfntfont_probe_widths, sfntfont_open, sfntfont_measure_pcm) (sfntfont_draw): More minor fixes to variable fonts.
* Update Android portPo Lu2023-03-27
| | | | | | | | | | | | | | | | | * configure.ac (HAVE_OTF_GET_VARIATION_GLYPHS): Check for `hb_font_set_var_named_instance'. * src/sfnt.c (main): Update tests. * src/sfntfont-android.c (Fandroid_enumerate_fonts): Blacklist bad font. * src/sfntfont.c (struct sfnt_font_tables, struct sfnt_font_desc) (sfnt_decode_instance_name, sfnt_weight_descriptions) (sfnt_enum_font_1, sfntfont_list_1, sfntfont_desc_to_entity) (sfntfont_list, struct sfntfont_get_glyph_outline_dcontext) (sfntfont_get_glyph, sfntfont_get_glyph_outline) (struct sfnt_font_info, sfnt_close_tables, sfnt_open_tables) (sfntfont_open, sfntfont_measure_pcm, sfntfont_close) (sfntfont_draw, sfntfont_begin_hb_font, syms_of_sfntfont) (mark_sfntfont): Handle variable fonts correctly.
* Refactor sfntfont.cPo Lu2023-03-27
| | | | | | | | | | | | | | | | | * src/sfnt.c (sfnt_build_glyph_outline): Take scale, not head and pixel size. (sfnt_scale_metrics_to_pixel_size): Delete function. (sfnt_get_scale): New function. (main): Update tests. * src/sfnt.h (PROTOTYPE): Update prototypes. * src/sfntfont.c (struct sfnt_outline_cache) (sfntfont_get_glyph_outline, struct sfnt_font_info) (sfntfont_open): Save scale in font information and use it. (sfntfont_measure_instructed_pcm): Delete function. (sfntfont_measure_pcm): Make this the only ``measure pcm'' function. (sfntfont_draw): Rely on sfntfont_get_glyph_outline for the scale.