2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* cfftoken.h
|
|
|
|
*
|
|
|
|
* CFF token definitions (specification only).
|
|
|
|
*
|
2024-01-27 17:11:22 +01:00
|
|
|
* Copyright (C) 1996-2024 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
#undef FT_STRUCTURE
|
2002-03-14 09:57:10 +01:00
|
|
|
#define FT_STRUCTURE CFF_FontRecDictRec
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
#undef CFFCODE
|
[cff] Implement CFF2 support (1/2).
This commit does not contain the blend code for font variation
support, which follows in another commit.
You should ignore whitespace while inspecting this commit.
* include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2'
member.
* src/cff/cf2font.h (CF2_Font): Add `isCFF2' member.
* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2'
flag.
(cf2_getMaxstack): New function.
* src/cff/cf2ft.h: Updated.
* src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum.
(cf2_interpT2CharString): Handle CFF2 differences.
Add tracing message for errors.
* src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index):
Update for CFF2.
* src/cff/cffload.c (FT_FIXED_ONE): New macro.
(cff_index_init, cff_index_load_offsets, cff_index_access_element,
cff_index_get_name, cff_ft_select_get, cff_load_private_dict,
cff_subfont_load, cff_font_load): Handle CFF2.
* src/cff/cffload.h: Updated.
* src/cff/cffobjs.c (cff_face_init): Handle CFF2.
* src/cff/cffparse.c (cff_parse_maxstack): New function.
(CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed
* src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New
macros.
(CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New
macros.
* src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend
stuff).
* src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field.
(CFF_FontRecDict): Add `maxstack' field.
(CFF_Private): Add `subfont' field.
(CFF_Font): Add `top_dict_length' and `cff2' fields.
* src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table.
2016-12-15 20:27:47 +01:00
|
|
|
#define CFFCODE CFF_CODE_TOPDICT
|
2000-12-08 03:42:29 +01:00
|
|
|
|
[cff] Better tracing of the parsing process.
* src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with
FT_TRACE.
* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_private_dict, cff_parse_cid_ros): Updated.
(CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000,
CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD,
CFF_FIELD_DELTA): Add argument for ID.
(cff_parser_run): Decorate with FT_TRACE.
* src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add
`id' member.
* src/cff/cfftoken.h: Add IDs to all fields.
2011-08-25 13:41:16 +02:00
|
|
|
CFF_FIELD_STRING ( 0, version, "Version" )
|
|
|
|
CFF_FIELD_STRING ( 1, notice, "Notice" )
|
|
|
|
CFF_FIELD_STRING ( 0x100, copyright, "Copyright" )
|
|
|
|
CFF_FIELD_STRING ( 2, full_name, "FullName" )
|
|
|
|
CFF_FIELD_STRING ( 3, family_name, "FamilyName" )
|
|
|
|
CFF_FIELD_STRING ( 4, weight, "Weight" )
|
|
|
|
CFF_FIELD_BOOL ( 0x101, is_fixed_pitch, "isFixedPitch" )
|
|
|
|
CFF_FIELD_FIXED ( 0x102, italic_angle, "ItalicAngle" )
|
|
|
|
CFF_FIELD_FIXED ( 0x103, underline_position, "UnderlinePosition" )
|
|
|
|
CFF_FIELD_FIXED ( 0x104, underline_thickness, "UnderlineThickness" )
|
|
|
|
CFF_FIELD_NUM ( 0x105, paint_type, "PaintType" )
|
|
|
|
CFF_FIELD_NUM ( 0x106, charstring_type, "CharstringType" )
|
|
|
|
CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" )
|
|
|
|
CFF_FIELD_NUM ( 13, unique_id, "UniqueID" )
|
|
|
|
CFF_FIELD_CALLBACK( 5, font_bbox, "FontBBox" )
|
|
|
|
CFF_FIELD_NUM ( 0x108, stroke_width, "StrokeWidth" )
|
2016-02-14 16:03:15 +01:00
|
|
|
#if 0
|
|
|
|
CFF_FIELD_DELTA ( 14, xuid, 16, "XUID" )
|
|
|
|
#endif
|
[cff] Better tracing of the parsing process.
* src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with
FT_TRACE.
* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_private_dict, cff_parse_cid_ros): Updated.
(CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000,
CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD,
CFF_FIELD_DELTA): Add argument for ID.
(cff_parser_run): Decorate with FT_TRACE.
* src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add
`id' member.
* src/cff/cfftoken.h: Add IDs to all fields.
2011-08-25 13:41:16 +02:00
|
|
|
CFF_FIELD_NUM ( 15, charset_offset, "charset" )
|
|
|
|
CFF_FIELD_NUM ( 16, encoding_offset, "Encoding" )
|
|
|
|
CFF_FIELD_NUM ( 17, charstrings_offset, "CharStrings" )
|
|
|
|
CFF_FIELD_CALLBACK( 18, private_dict, "Private" )
|
|
|
|
CFF_FIELD_NUM ( 0x114, synthetic_base, "SyntheticBase" )
|
|
|
|
CFF_FIELD_STRING ( 0x115, embedded_postscript, "PostScript" )
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
#if 0
|
[cff] Better tracing of the parsing process.
* src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with
FT_TRACE.
* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_private_dict, cff_parse_cid_ros): Updated.
(CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000,
CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD,
CFF_FIELD_DELTA): Add argument for ID.
(cff_parser_run): Decorate with FT_TRACE.
* src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add
`id' member.
* src/cff/cfftoken.h: Add IDs to all fields.
2011-08-25 13:41:16 +02:00
|
|
|
CFF_FIELD_STRING ( 0x116, base_font_name, "BaseFontName" )
|
|
|
|
CFF_FIELD_DELTA ( 0x117, base_font_blend, 16, "BaseFontBlend" )
|
2016-02-14 16:03:15 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* the next two operators were removed from the Type2 specification */
|
|
|
|
/* in version 16-March-2000 */
|
[cff] Better tracing of the parsing process.
* src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with
FT_TRACE.
* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_private_dict, cff_parse_cid_ros): Updated.
(CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000,
CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD,
CFF_FIELD_DELTA): Add argument for ID.
(cff_parser_run): Decorate with FT_TRACE.
* src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add
`id' member.
* src/cff/cfftoken.h: Add IDs to all fields.
2011-08-25 13:41:16 +02:00
|
|
|
CFF_FIELD_CALLBACK( 0x118, multiple_master, "MultipleMaster" )
|
2016-02-14 16:03:15 +01:00
|
|
|
#if 0
|
|
|
|
CFF_FIELD_CALLBACK( 0x11A, blend_axis_types, "BlendAxisTypes" )
|
2000-12-08 03:42:29 +01:00
|
|
|
#endif
|
|
|
|
|
[cff] Better tracing of the parsing process.
* src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with
FT_TRACE.
* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_private_dict, cff_parse_cid_ros): Updated.
(CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000,
CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD,
CFF_FIELD_DELTA): Add argument for ID.
(cff_parser_run): Decorate with FT_TRACE.
* src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add
`id' member.
* src/cff/cfftoken.h: Add IDs to all fields.
2011-08-25 13:41:16 +02:00
|
|
|
CFF_FIELD_CALLBACK( 0x11E, cid_ros, "ROS" )
|
|
|
|
CFF_FIELD_NUM ( 0x11F, cid_font_version, "CIDFontVersion" )
|
|
|
|
CFF_FIELD_NUM ( 0x120, cid_font_revision, "CIDFontRevision" )
|
|
|
|
CFF_FIELD_NUM ( 0x121, cid_font_type, "CIDFontType" )
|
|
|
|
CFF_FIELD_NUM ( 0x122, cid_count, "CIDCount" )
|
|
|
|
CFF_FIELD_NUM ( 0x123, cid_uid_base, "UIDBase" )
|
|
|
|
CFF_FIELD_NUM ( 0x124, cid_fd_array_offset, "FDArray" )
|
|
|
|
CFF_FIELD_NUM ( 0x125, cid_fd_select_offset, "FDSelect" )
|
|
|
|
CFF_FIELD_STRING ( 0x126, cid_font_name, "FontName" )
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
#if 0
|
[cff] Better tracing of the parsing process.
* src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with
FT_TRACE.
* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_private_dict, cff_parse_cid_ros): Updated.
(CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000,
CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD,
CFF_FIELD_DELTA): Add argument for ID.
(cff_parser_run): Decorate with FT_TRACE.
* src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add
`id' member.
* src/cff/cfftoken.h: Add IDs to all fields.
2011-08-25 13:41:16 +02:00
|
|
|
CFF_FIELD_NUM ( 0x127, chameleon, "Chameleon" )
|
2000-12-08 03:42:29 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#undef FT_STRUCTURE
|
2002-02-28 19:59:37 +01:00
|
|
|
#define FT_STRUCTURE CFF_PrivateRec
|
2000-12-08 03:42:29 +01:00
|
|
|
#undef CFFCODE
|
[cff] Implement CFF2 support (1/2).
This commit does not contain the blend code for font variation
support, which follows in another commit.
You should ignore whitespace while inspecting this commit.
* include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2'
member.
* src/cff/cf2font.h (CF2_Font): Add `isCFF2' member.
* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2'
flag.
(cf2_getMaxstack): New function.
* src/cff/cf2ft.h: Updated.
* src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum.
(cf2_interpT2CharString): Handle CFF2 differences.
Add tracing message for errors.
* src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index):
Update for CFF2.
* src/cff/cffload.c (FT_FIXED_ONE): New macro.
(cff_index_init, cff_index_load_offsets, cff_index_access_element,
cff_index_get_name, cff_ft_select_get, cff_load_private_dict,
cff_subfont_load, cff_font_load): Handle CFF2.
* src/cff/cffload.h: Updated.
* src/cff/cffobjs.c (cff_face_init): Handle CFF2.
* src/cff/cffparse.c (cff_parse_maxstack): New function.
(CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed
* src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New
macros.
(CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New
macros.
* src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend
stuff).
* src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field.
(CFF_FontRecDict): Add `maxstack' field.
(CFF_Private): Add `subfont' field.
(CFF_Font): Add `top_dict_length' and `cff2' fields.
* src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table.
2016-12-15 20:27:47 +01:00
|
|
|
#define CFFCODE CFF_CODE_PRIVATE
|
2000-12-08 03:42:29 +01:00
|
|
|
|
[CFF] Extract `BlueValues` as `Fixed` rather than `Int`.
This is a follow-up to commit 26a7f047,
[cff] Make blend operator work with floats in private dicts.
which addressed the 'party baseline' bug. However, the reporting user
indicated that the default location and some other points in design space
rendered OK, but other points in design space still had problems. The most
obvious issue being that the x-heights of lower-case letters did not align;
see
https://github.com/adobe-fonts/source-serif/issues/121#issuecomment-1773794136
After some analysis we determined that this was due to an interaction
between `BlueValue` rounding and the zone-based algorithm. In short, for a
point to be considered in a zone it must fall within the bounds of the zone.
(There is a slop factor in some cases, but only a very small one.) In the
Adobe-contributed side of the code, point values are not integer-rounded,
instead they're kept as (some form of) fixed. Rounding just the `BlueValues`
means that points that need to be considered within a zone will fall outside
of it at some points in design space.
The majority of this patch changes the storage and parsing of `BlueValues`
to keep them as `FT_Fixed`. No significant code changes were needed because
the values are converted to `Fixed` anyway when stored in `CF_BlueRec`. No
attempt was made to address problems in the older pshinter code beyond
converting the values from `FT_Fixed` to `FT_Short` when copying the private
dictionary. (However, as the point values are also rounded in that code,
the problem is much less likely to occur, although inconsistency between
rounding and truncation could cause an analogous problem.)
* include/freetype/internal/cfftypes.h (CFF_PrivateRec): Use `FT_Fixed` for
`blue_values`, `other_blues`, `family_blues`, and `family_other_blues`.
* src/cff/cffload.c (cff_blend_doBlend): Updated.
* src/cff/cffobjs.c (CFF_fixedToInt): New macro.
(cff_make_private_dict): Use it.
* src/cff/cffparse.h (cff_kind_delta_fixed): New enum value.
* src/cff/cffparse.c (do_fixed): Updated.
(CFF_FIELD_DELTA, CFF_FIELD_DELTA_FIXED, CFF_DELTA_KIND): New set of macros,
replacing `CFF_FIELD_DELTA`.
(cff_parser_run): Updated to handle fixed-float deltas.
* src/cff/cfftoken.h: Updated to use `CFF_FIELD_DELTA_FIXED` for blue
values.
* src/psaux/psblues.c (cf2_blueToFixed): Removed, no longer needed.
(cf2_blues_init): Updated.
* src/pxaux/psft.c, src/pxaux/psft.h (cf2_getBlueValues, cf2_getOtherBlues,
cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Updated signatures.
* src/psaux/psobjs.c (t1_make_subfont): Updated.
2023-12-14 06:59:05 +01:00
|
|
|
CFF_FIELD_DELTA_FIXED( 6, blue_values, 14, "BlueValues" )
|
|
|
|
CFF_FIELD_DELTA_FIXED( 7, other_blues, 10, "OtherBlues" )
|
|
|
|
CFF_FIELD_DELTA_FIXED( 8, family_blues, 14, "FamilyBlues" )
|
|
|
|
CFF_FIELD_DELTA_FIXED( 9, family_other_blues, 10, "FamilyOtherBlues" )
|
|
|
|
CFF_FIELD_FIXED_1000 ( 0x109, blue_scale, "BlueScale" )
|
|
|
|
CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
|
|
|
|
CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
|
|
|
|
CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
|
|
|
|
CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
|
|
|
|
CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
|
|
|
|
CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
|
|
|
|
CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" )
|
|
|
|
CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" )
|
|
|
|
CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" )
|
|
|
|
CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
|
|
|
|
CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
|
|
|
|
CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" )
|
|
|
|
CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
|
|
|
|
CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" )
|
|
|
|
CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" )
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
|
[cff] Implement CFF2 support (1/2).
This commit does not contain the blend code for font variation
support, which follows in another commit.
You should ignore whitespace while inspecting this commit.
* include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2'
member.
* src/cff/cf2font.h (CF2_Font): Add `isCFF2' member.
* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2'
flag.
(cf2_getMaxstack): New function.
* src/cff/cf2ft.h: Updated.
* src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum.
(cf2_interpT2CharString): Handle CFF2 differences.
Add tracing message for errors.
* src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index):
Update for CFF2.
* src/cff/cffload.c (FT_FIXED_ONE): New macro.
(cff_index_init, cff_index_load_offsets, cff_index_access_element,
cff_index_get_name, cff_ft_select_get, cff_load_private_dict,
cff_subfont_load, cff_font_load): Handle CFF2.
* src/cff/cffload.h: Updated.
* src/cff/cffobjs.c (cff_face_init): Handle CFF2.
* src/cff/cffparse.c (cff_parse_maxstack): New function.
(CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed
* src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New
macros.
(CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New
macros.
* src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend
stuff).
* src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field.
(CFF_FontRecDict): Add `maxstack' field.
(CFF_Private): Add `subfont' field.
(CFF_Font): Add `top_dict_length' and `cff2' fields.
* src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table.
2016-12-15 20:27:47 +01:00
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE CFF_FontRecDictRec
|
|
|
|
#undef CFFCODE
|
|
|
|
#define CFFCODE CFF2_CODE_TOPDICT
|
|
|
|
|
|
|
|
CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" )
|
|
|
|
CFF_FIELD_NUM ( 17, charstrings_offset, "CharStrings" )
|
|
|
|
CFF_FIELD_NUM ( 0x124, cid_fd_array_offset, "FDArray" )
|
|
|
|
CFF_FIELD_NUM ( 0x125, cid_fd_select_offset, "FDSelect" )
|
[cff] Implement CFF2 support (2/2).
The font variation code. All parts dependent on the GX code in the
`truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
In other words, you can still compile the `cff' module without
defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2
support without font variation).
* src/cff/cf2font.c (cf2_font_setup): Add support for font
variation.
* src/cff/cf2font.h (CF2_Font): Add fields for variation data.
* src/cff/cf2ft.c (cf2_free_instance): Free blend data.
(cf2_getVStore, cf2_getNormalizedVector): New functions.
* src/cff/cf2ft.h: Updated.
* src/cff/cf2intrp.c: Include `cffload.h'.
(cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with...
(cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values.
(cf2_doBlend): New function.
(cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes.
* src/cff/cffload.c (FT_fdot14ToFixed): New macro.
(cff_vstore_done, cff_vstore_load): New functions.
(cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector,
cff_blend_check_vector): New functions.
(cff_load_private_dict): Add arguments for blend vector.
Handle blend data.
(cff_subfont_load, cff_subfont_done): Updated.
(cff_font_load): Handle CFF2 variation store data.
(cff_font_done): Updated.
* src/cff/cffload.h: Include `cffparse.h'.
Updated.
* src/cff/cffobjs.c (cff_face_done): Updated.
* src/cff/cffparse.c: Include `cffload.h'.
(cff_parse_num): Handle internal value 255.
(cff_parse_vsindex, cff_parse_blend): New functions.
(CFF_FIELD_BLEND): New macro.
(cff_parser_run): Updated.
* src/cff/cffparse.h (cff_kind_blend): New enum value.
* src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend'
dictionary values.
* src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion,
CFF_VStore, CFF_Blend): New structures.
(CFF_FontRecDict): Add `vstore_offset' field.
(CFF_Private): Add `vsindex' field.
(CFF_SubFont): Add fields for blend data.
(CFF_Font): Add `vstore' field.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar',
since glyph variation data is directly embedded.
(TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts.
2016-12-15 21:56:44 +01:00
|
|
|
CFF_FIELD_NUM ( 24, vstore_offset, "vstore" )
|
[cff] Implement CFF2 support (1/2).
This commit does not contain the blend code for font variation
support, which follows in another commit.
You should ignore whitespace while inspecting this commit.
* include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2'
member.
* src/cff/cf2font.h (CF2_Font): Add `isCFF2' member.
* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2'
flag.
(cf2_getMaxstack): New function.
* src/cff/cf2ft.h: Updated.
* src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum.
(cf2_interpT2CharString): Handle CFF2 differences.
Add tracing message for errors.
* src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index):
Update for CFF2.
* src/cff/cffload.c (FT_FIXED_ONE): New macro.
(cff_index_init, cff_index_load_offsets, cff_index_access_element,
cff_index_get_name, cff_ft_select_get, cff_load_private_dict,
cff_subfont_load, cff_font_load): Handle CFF2.
* src/cff/cffload.h: Updated.
* src/cff/cffobjs.c (cff_face_init): Handle CFF2.
* src/cff/cffparse.c (cff_parse_maxstack): New function.
(CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed
* src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New
macros.
(CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New
macros.
* src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend
stuff).
* src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field.
(CFF_FontRecDict): Add `maxstack' field.
(CFF_Private): Add `subfont' field.
(CFF_Font): Add `top_dict_length' and `cff2' fields.
* src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table.
2016-12-15 20:27:47 +01:00
|
|
|
CFF_FIELD_CALLBACK( 25, maxstack, "maxstack" )
|
|
|
|
|
|
|
|
|
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE CFF_FontRecDictRec
|
|
|
|
#undef CFFCODE
|
|
|
|
#define CFFCODE CFF2_CODE_FONTDICT
|
|
|
|
|
|
|
|
CFF_FIELD_CALLBACK( 18, private_dict, "Private" )
|
|
|
|
CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" )
|
|
|
|
|
|
|
|
|
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE CFF_PrivateRec
|
|
|
|
#undef CFFCODE
|
|
|
|
#define CFFCODE CFF2_CODE_PRIVATE
|
|
|
|
|
[CFF] Extract `BlueValues` as `Fixed` rather than `Int`.
This is a follow-up to commit 26a7f047,
[cff] Make blend operator work with floats in private dicts.
which addressed the 'party baseline' bug. However, the reporting user
indicated that the default location and some other points in design space
rendered OK, but other points in design space still had problems. The most
obvious issue being that the x-heights of lower-case letters did not align;
see
https://github.com/adobe-fonts/source-serif/issues/121#issuecomment-1773794136
After some analysis we determined that this was due to an interaction
between `BlueValue` rounding and the zone-based algorithm. In short, for a
point to be considered in a zone it must fall within the bounds of the zone.
(There is a slop factor in some cases, but only a very small one.) In the
Adobe-contributed side of the code, point values are not integer-rounded,
instead they're kept as (some form of) fixed. Rounding just the `BlueValues`
means that points that need to be considered within a zone will fall outside
of it at some points in design space.
The majority of this patch changes the storage and parsing of `BlueValues`
to keep them as `FT_Fixed`. No significant code changes were needed because
the values are converted to `Fixed` anyway when stored in `CF_BlueRec`. No
attempt was made to address problems in the older pshinter code beyond
converting the values from `FT_Fixed` to `FT_Short` when copying the private
dictionary. (However, as the point values are also rounded in that code,
the problem is much less likely to occur, although inconsistency between
rounding and truncation could cause an analogous problem.)
* include/freetype/internal/cfftypes.h (CFF_PrivateRec): Use `FT_Fixed` for
`blue_values`, `other_blues`, `family_blues`, and `family_other_blues`.
* src/cff/cffload.c (cff_blend_doBlend): Updated.
* src/cff/cffobjs.c (CFF_fixedToInt): New macro.
(cff_make_private_dict): Use it.
* src/cff/cffparse.h (cff_kind_delta_fixed): New enum value.
* src/cff/cffparse.c (do_fixed): Updated.
(CFF_FIELD_DELTA, CFF_FIELD_DELTA_FIXED, CFF_DELTA_KIND): New set of macros,
replacing `CFF_FIELD_DELTA`.
(cff_parser_run): Updated to handle fixed-float deltas.
* src/cff/cfftoken.h: Updated to use `CFF_FIELD_DELTA_FIXED` for blue
values.
* src/psaux/psblues.c (cf2_blueToFixed): Removed, no longer needed.
(cf2_blues_init): Updated.
* src/pxaux/psft.c, src/pxaux/psft.h (cf2_getBlueValues, cf2_getOtherBlues,
cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Updated signatures.
* src/psaux/psobjs.c (t1_make_subfont): Updated.
2023-12-14 06:59:05 +01:00
|
|
|
CFF_FIELD_DELTA_FIXED( 6, blue_values, 14, "BlueValues" )
|
|
|
|
CFF_FIELD_DELTA_FIXED( 7, other_blues, 10, "OtherBlues" )
|
|
|
|
CFF_FIELD_DELTA_FIXED( 8, family_blues, 14, "FamilyBlues" )
|
|
|
|
CFF_FIELD_DELTA_FIXED( 9, family_other_blues, 10, "FamilyOtherBlues" )
|
|
|
|
CFF_FIELD_FIXED_1000 ( 0x109, blue_scale, "BlueScale" )
|
|
|
|
CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
|
|
|
|
CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
|
|
|
|
CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
|
|
|
|
CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
|
|
|
|
CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
|
|
|
|
CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
|
|
|
|
CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
|
|
|
|
CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
|
|
|
|
CFF_FIELD_CALLBACK ( 22, vsindex, "vsindex" )
|
|
|
|
CFF_FIELD_BLEND ( 23, "blend" )
|
|
|
|
CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
|
[cff] Implement CFF2 support (1/2).
This commit does not contain the blend code for font variation
support, which follows in another commit.
You should ignore whitespace while inspecting this commit.
* include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2'
member.
* src/cff/cf2font.h (CF2_Font): Add `isCFF2' member.
* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2'
flag.
(cf2_getMaxstack): New function.
* src/cff/cf2ft.h: Updated.
* src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum.
(cf2_interpT2CharString): Handle CFF2 differences.
Add tracing message for errors.
* src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index):
Update for CFF2.
* src/cff/cffload.c (FT_FIXED_ONE): New macro.
(cff_index_init, cff_index_load_offsets, cff_index_access_element,
cff_index_get_name, cff_ft_select_get, cff_load_private_dict,
cff_subfont_load, cff_font_load): Handle CFF2.
* src/cff/cffload.h: Updated.
* src/cff/cffobjs.c (cff_face_init): Handle CFF2.
* src/cff/cffparse.c (cff_parse_maxstack): New function.
(CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed
* src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New
macros.
(CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New
macros.
* src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend
stuff).
* src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field.
(CFF_FontRecDict): Add `maxstack' field.
(CFF_Private): Add `subfont' field.
(CFF_Font): Add `top_dict_length' and `cff2' fields.
* src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table.
2016-12-15 20:27:47 +01:00
|
|
|
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
/* END */
|