Commit Graph

114 Commits

Author SHA1 Message Date
Werner Lemberg b57bb11ad0 [autofit] Fix signedness issues.
* src/autofit/afangles.c, src/autofit/afcjk.c,
src/autofit/afglobal.c, src/autofit/afhints.c,
src/autofit/aflatin.c, src/autofit/aflatin2.c, src/autofit/afwarp.c,
src/autofit/hbshim.c: Apply.
2015-02-19 10:44:18 +01:00
Werner Lemberg 81e5ff53a8 [autofit] Use macros for (unsigned) flags, not enumerations.
This harmonizes with other code in FreeType (and reduces the number
of necessary casts to avoid compiler warnings).

* src/autofit/afblue.hin: Make flag macros unsigned.
* src/autofit/afblue.h: Regenerated.

* src/autofit/afcjk.h: Replace flag enumeration with macros.
* src/autofit/afcjk.c: Updated.

* src/autofit/afhints.h (AF_Flags, AF_Edge_Flags): Replace with
macros.
* src/autofit/afhints.c: Updated.

* src/autofit/aflatin.h: Replace flag enumerations with macros.
* src/autofit/aflatin.c, src/autofit/aflatin2.c: Updated.

* src/autofit/aftypes.h (AF_ScalerFlags): Replace with macros.
2015-02-19 09:46:48 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Werner Lemberg 5b68e4fb60 [autofit] Minor clean-ups.
* src/autofit/afhints.c (AF_FLAGS): Remove obsolete values.

* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_align_strong_points): Updated.

* src/autofit/aflatin.c (af_latin_hints_link_segments,
af_latin_hints_compute_segments), src/autofit/afcjk.c
(af_cjk_hints_link_segments), src/autofit/aflatin2.c
(af_latin2_hints_link_segments, af_latin2_hints_compute_segments):
There are no longer fake segments since more than 10 years...
2014-09-24 19:06:13 +02:00
Werner Lemberg 378266dc1a Formatting. 2014-09-22 06:33:38 +02:00
Werner Lemberg 98e510ee94 [autofit] Fix Savannah bug #42148.
The adaptation of the cjk auto-hinter module to blue stringsets in
2013-08-25 had three severe bugs.  Mea culpa.

1. Contrary to the latin auto-hinter, characters for reference and
   overshoot values of a blue zone are specified separately.  Due to
   the screwed-up change it didn't work at all.

2. A boolean comparison was erroneously replaced with a cast,
   causing invalid results with the `^' operator later on.  The
   visual artifact caused by this problem is the topic of the bug
   report.

3. Two flag values were inverted, causing incorrect assignment of
   reference and overshoot values.

* src/autofit/afblue.dat: Fix CJK bluestrings, introducing a new
syntax to have both reference and overshoot characters in a single
string.  This is error #1.
Add extensive comments.

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_CJK_FILL): Removed, no
longer used.
(AF_BLUE_PROPERTY_CJK_TOP, AF_BLUE_PROPERTY_CJK_HORIZ): Fix values.
This is error #3.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Correct error #1.
Use character `|' to separate characters for reference and overshoot
values.
Improve tracing messages, synchronizing them with the latin
auto-hinter.
(af_cjk_hints_compute_blue_edges): Fix value of `is_top_right_blue'.
This is error #2.
(af_cjk_align_linked_edge): Add tracing message.

* src/autofit/afcjk.h (AF_CJK_IS_FILLED_BLUE): Removed, no longer
used.
2014-04-20 22:11:27 +02:00
Werner Lemberg 71f53e122b [autofit] Improve scoring algorithm for identifying stems.
Problem reported by Karsten Lücke <karsten.luecke@kltf.de>.

The new algorithm takes care of the width of stems: If the distance
between two segments is larger than the largest stem width, the
demerits quickly increase for larger distances.  This improves
hinting of slanted fonts (especially if the inner parts of serifs
have non-horizontal `shoulders'), avoiding false stem links.

* src/autofit/aflatin.c (af_latin_hints_link_segments): Use largest
stem width (if available) to compute better demerits for distances
between stems.
(af_latin_hints_detect_features): Pass stem width array and array
size.
(af_latin_metrics_init_widths): Updated to use original algorithm.
(af_latin_hints_apply): Updated to use new algorithm.

* src/autofit/aflatin.h: Updated.
* src/autofit/afcjk.c: Updated.
2014-04-05 16:27:19 +02:00
Werner Lemberg a8772918a3 [autofit] Minor fix.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Fix handling
of alternative standard characters.
This also fixes a compilation warning in non-debug mode.
2014-02-04 11:36:08 +01:00
Werner Lemberg a336400112 [autofit] Introduce two more slots for standard characters.
This is useful for OpenType features like `c2sc' (caps to small
caps) that don't have lowercase letters by definition, or other
features that mainly operate on numerals.

* src/autofit/afscript.h: Add more standard characters.

* src/autofit/aftypes.h: Update use of `SCRIPT' macro.
(AF_ScriptClassRec): Add members to hold two more standard
characters.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afglobal.c, src/autofit/afglobal.h,
* src/autofit/afpic.c, src/autofit/afranges.h, src/autofit/hbshim.c:
Update use of `SCRIPT' macro.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Scan two more
standard characters.
2014-01-26 09:45:23 +01:00
Werner Lemberg 785f38573b [autofit] s/AF_STYLE_...._DEFAULT/AF_STYLE_...._DFLT/i. 2013-12-31 09:45:10 +01:00
Werner Lemberg c9d9947c68 [autofit] Fix interface of `af_get_char_index'.
* src/autofit/hbshim.c (af_get_char_index): Return error value.
Add argument for y offset (to be used in a yet-to-come patch).

* src/autofit/hbshim.h, src/autofit/afcjk.c,
src/autofit/aflatin.c: Updated.
2013-12-31 08:16:57 +01:00
Werner Lemberg 17af586e05 [autofit] Add wrapper function for `FT_Get_Char_Index'.
Yet-to-come changes will provide HarfBuzz functionality for the new
function.

* src/autofit/hbshim.c (af_get_char_index): New function.
* src/autofit/hbshim.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits):
Updated.
2013-12-28 10:33:01 +01:00
Werner Lemberg 8a8f3758f1 [autofit] Fix PIC compilation.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths)
[FT_CONFIG_OPTION_PIC]: Declare `globals'.

* src/autofit/afglobal.c: Always call AF_DEFINE_SCRIPT_CLASS, and
AF_DEFINE_STYLE_CLASS.

* src/autofit/afpic.c: Include `afglobal.h'.
(autofit_module_class_pic_init): Typo.

* src/autofit/aftypes.h (AF_DEFINE_SCRIPT_CLASS,
AF_DEFINE_STYLE_CLASS): Don't use the same identifier for macro
parameter and structure member.
2013-12-20 18:35:35 +01:00
Werner Lemberg 974b193bcc [autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.

* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.

* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.

* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.

* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition.  This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.

* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.

* src/autofit/afranges.h: Updated.

* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
Werner Lemberg d8324571f1 [autofit] Factor scripts and uniranges out of writing system files.
* src/autofit/afranges.c, src/autofit/afranges.h: New files.

* src/autofit/afscript.h: Extend `SCRIPT' macro with more
parameters, taking data from the writing system files.

* src/autofit/aftypes.h: Updated.

* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DEFINE_SCRIPT_CLASS.
* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DECLARE_SCRIPT_CLASS.

* src/autofit/afcjk.c, src/autofit/afcjk.h: Updated.
* src/autofit/afdummy.c, src/autofit/afdummy.h: Updated.
* src/autofit/afindic.c, src/autofit/afindic.h: Updated.
* src/autofit/aflatin.c, src/autofit/aflatin.h: Updated.
* src/autofit/aflatn2.c, src/autofit/aflatn2.h: Updated.

* src/autofit/afpic.c: Updated.

* src/autofir/autofit.c: Include `afranges.c'.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afranges.c'.
2013-12-19 15:45:24 +01:00
Werner Lemberg 4593062207 [autofit] Minor. 2013-12-19 15:24:39 +01:00
Werner Lemberg 73f3198101 [autofit] More code orthogonality.
* src/autofit/aftypes.h (AF_StyleMetrics): Replace `script_class'
pointer to an `AF_ScriptClass' structure with `script' index of type
`AF_Script'.
Move some code around.

* src/autofit/afcjk.c: Include `afpic.h'.
(af_cjk_metrics_init_widths, af_cjk_metrics_init_blues,
af_cjk_hint_edges): Updated.

* src/autofit/aflatin.c: Include `afpic.h'.
(af_latin_metrics_init_widths, af_latin_metrics_init_blues,
af_latin_metrics_scale_dim, af_latin_hint_edges): Updated.

* src/autofit/afglobal.c (af_face_globals_get_metrics): Updated.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
2013-12-19 15:24:17 +01:00
Werner Lemberg 3f91cb338b [autofit] s/ScriptMetrics/StyleMetrics/. 2013-12-18 12:59:35 +01:00
Werner Lemberg 7a5fc2f362 [autofit] s/AF_Script_/AF_WritingSystem_/ where appropriate. 2013-12-17 13:29:53 +01:00
Werner Lemberg 4de7787f22 Fix Savannah bug #40090.
* src/autofit/afcjk.c (af_cjk_metrics_scale): Revert commit
306f8c5d (from 2013-08-25) affecting this function.
2013-09-23 22:10:08 +02:00
Werner Lemberg 5195ecd62f [autofit] Fix `make multi' compilation.
* src/autofit/afblue.cin, src/autofit/afblue.c: Don't include
`afblue.h' but `aftypes.h'.
* src/autofit/afcjk.c: Don't include `aftypes.h' but `afglobal.h'.
2013-08-28 17:41:21 +02:00
Werner Lemberg 5e53db25ff [autofit] While tracing, report script names instead of ID values.
* src/autofit/afglobal.c (af_script_names) [FT_DEBUG_LEVEL_TRACE]:
New array.
* src/autofit/afglobal.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_hint_edges): Use `af_script_names'.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_hint_edges): Ditto.
2013-08-27 18:37:39 +02:00
Werner Lemberg 278f64b330 [autofit] Report used script while hinting a glyph.
* src/autofit/afcjk.c (af_cjk_hint_edges), src/autofit/aflatin.c
(af_latin_hint_edges): Implement it.
2013-08-26 20:20:03 +02:00
Werner Lemberg 098121dbb9 [autofit] Improve tracing messages.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Mention script
ID in tracing message.
(af_cjk_metrics_init_blues): Initialize `axis' outside of the inner
loop.
Improve tracing messages.
(af_cjk_hint_edges) [FT_DEBUG_LEVEL_TRACE]: New variable
`num_actions' to count hinting actions.
Improve tracing messages.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Mention
script ID in tracing message.
(af_latin_metrics_init_blues, af_latin_hint_edges): Improve tracing
messages.
2013-08-26 18:54:05 +02:00
Werner Lemberg c1eb445965 [autofit] Make `cjk' module use blue stringsets.
* src/autofit/afcjk.c (AF_CJK_MAX_TEST_CHARACTERS): Removed.
(af_cjk_hani_blue_chars): Removed.
(AF_CJK_BLUE_TYPE_*): Removed.
(af_cjk_metrics_init_blues): Replace AF_CJK_MAX_TEST_CHARACTERS with
AF_BLUE_STRING_MAX_LEN.
Change loops to use offsets (in file `afblue.h') into the new arrays
`af_blue_stringsets' and `af_blue_strings' (in file `afblue.c').
Instead of three dimensions (as used in the old blue string array)
we now use properties to do the same, saving one loop nesting level.

* src/autofit/afcjk.h: Remove old enumeration values superseded by
the new data in `afblue.h'.
(AF_CJK_IS_TOP_BLUE, AF_CJK_IS_HORIZ_BLUE, AF_CJK_IS_FILLED_BLUE,
AF_CJK_IS_RIGHT_BLUE): New macros, to be used in
`af_cjk_metrics_init_blues'.
(AF_CJK_BLUE_IS_RIGHT): Remove this now redundant enum value.
(AF_CJK_BLUE_IS_TOP): Renamed to...
(AF_CJK_BLUE_TOP): This.
(AF_CJK_MAX_BLUES): Remove.
(AF_CJKAxisRec): Updated.
2013-08-25 19:47:26 +02:00
Werner Lemberg 306f8c5d89 [autofit] Synchronize `cjk' with `latin' module (and vice versa).
* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Add tracing
messages.
(af_cjk_metrics_init_blues): Don't pass blue string array as
argument but use the global array directly.
Use `outline' directly.
Update and add tracing messages.
(af_cjk_metrics_init): Simplify code.
(af_cjk_metrics_scale_dim): Improve tracing message.
(af_cjk_metrics_scale): Synchronize.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues): Improve and add tracing messages.
2013-08-25 13:07:08 +02:00
Werner Lemberg db3e5b9394 [autofit] Add blue stringsets.
* src/autofit/aftypes.h: Include `afblue.h'.
(AF_ScriptClassRec): Add `blue_stringset' field.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/autofit.c: Include `afblue.c'.

* src/autofit/afcjk.c (af_hani_script_class), src/autofit/afdummy.c
(af_dflt_script_class), src/autofit/afindic.c
(af_deva_script_class), src/autofit/aflatin.c
(af_latn_script_class), src/autofit/aflatin2.c
(af_ltn2_script_class): Updated.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afblue.c'.
2013-08-25 08:23:22 +02:00
Werner Lemberg 72f5ff5bbb [autofit] Introduce `writing systems'.
This patch adds a new top level to the auto-hinter's script class
hierarchy.  It defines `writing systems' which can contain multiple
scripts.

For example, the `latin' writing system (in file `aflatin.c') is
able to support scripts like Latin, Cyrillic, Armenian, etc., which
can be handled similarly.

Scripts are now named using four-letter OpenType tags.

* src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members
to...
(AF_WritingSystemClassRec): This new structure.  It holds pointers
to functions which can be shared among related scripts.
(AF_WritingSystem): New enumeration.
(AF_Script): Revised values using four-letter tags.
(AF_DEFINE_WRITING_SYSTEM_CLASS): New macro.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afglobal.c (af_writing_system_classes): New global,
constant array.
(af_script_classes): Updated.
(af_face_globals_free): Updated.
Remove assertion.
(af_face_globals_get_metrics): Updated.

* src/autofit/afglobal.h (AF_SCRIPT_FALLBACK)
[!AF_CONFIG_OPTION_CJK]: Handle this case.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated;
initialize structures for both writing systems and scripts.
* src/autofit/afpic.h: Updated.
(AF_WRITING_SYSTEM_CLASSES_GET): New macro.

* src/autofit/afcjk.c (af_cjk_writing_system_class): New writing
system.
(af_cjk_uniranges): Renamed to...
(af_hani_uniranges): This.
(af_cjk_script_class): Reduced and renamed to...
(af_hani_script_class): This.
* src/autofit/afcjk.h: Updated.

* src/autofit/afdummy.c (af_dummy_writing_system_class): New writing
system.
(af_dummy_script_class): Reduced and renamed to...
(af_dflt_script_class): This.
* src/autofit/afdummy.h: Updated.

* src/autofit/afindic.c (af_indic_writing_system_class): New writing
system.
(af_indic_uniranges): Renamed to...
(af_deva_uniranges): This.
(af_indic_script_class): Reduced and renamed to...
(af_deva_script_class): This.
* src/autofit/afcjk.h: Updated.

* src/autofit/aflatin.c (af_latin_writing_system_class): New writing
system.
(af_latin_uniranges): Renamed to...
(af_latn_uniranges): This.
(af_latin_script_class): Reduced and renamed to...
(af_latn_script_class): This.
* src/autofit/aflatin.h: Updated.

* src/autofit/aflatin2.c (af_latin2_writing_system_class): New
writing system.
(af_latin2_uniranges): Renamed to...
(af_ltn2_uniranges): This.
Synchronize ranges with `latin'.
(af_latin2_script_class): Reduced and renamed to...
(af_ltn2_script_class): This.
* src/autofit/aflatin2.h: Updated.
2013-07-31 22:57:01 +02:00
Werner Lemberg 5d6a360542 [autofit] Variable renaming.
* src/autofit/aftypes.h (AF_ScriptMetricsRec):
s/clazz/script_class/.
Update all users.
2013-07-31 22:57:01 +02:00
Werner Lemberg dc624ca4dc Apply fixes for cppcheck nitpicks.
http://cppcheck.sourceforge.net/

Note that the current version heavily chokes on FreeType, delivering
even wrong results.  I will report those issues to the cppcheck team
so that a newer version gives improved results hopefully.

*/* Improve variable scopes.
*/* Remove redundant initializations which get overwritten.

* src/base/ftmac.c ,builds/mac/ftmac.c (count_faces_scalable):
Remove unused variable.

* src/base/ftdbgmem.c (ft_mem_table_destroy): `table' can't be zero.

* src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt1_entry_validate):
Remove functionless code.

* src/tools/ftrandom.c (main): Fix memory leak.
2013-06-04 10:30:48 +02:00
Werner Lemberg eed830614f Whitespace. 2013-03-23 14:25:43 +01:00
Werner Lemberg e3c9301581 */*: Use FT_Err_Ok only.
This is a purely mechanical conversion.
2013-03-14 11:21:17 +01:00
Werner Lemberg 553bb3c3ca [autofit] Add standard character to `AF_ScriptClassRec' structure.
* src/autofit/aftypes.h (AF_ScriptClassRec): Add `standard_char'
member.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Use it.
(af_latin_metrics_init, af_latin_script_class): Updated.

* src/autofit/aflatin.c (af_latin2_metrics_init_widths): Use it.
(af_latin2_metrics_init, af_latin2_script_class): Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Use it.
(af_cjk_metrics_init, af_cjk_script_class): Updated.

* src/autofit/afindic.c(af_indic_metrics_init,
af_indic_script_class): Updated.

* src/autofit/afcjk.h, src/autofit/aflatin.h: Updated.

* src/autofit/afdummy.c: Updated.
2012-10-24 14:22:14 +02:00
Werner Lemberg 8ae2a65e09 [autofit] Update to Unicode 6.1.0.
* src/autofit/afcjk.c (af_cjk_uniranges), src/autofit/aflatin.c
(af_latin_uniranges): Add and fix ranges.
2012-09-14 14:10:01 +02:00
Werner Lemberg 2a9c4552f6 [autofit] Quantize stem widths.
* src/autofit/afangles.c (af_sort_widths): Rename to...
(af_sort_and_quantize_widths): This.
Add code to avoid stem widths which are almost identical.
* src/autofit/aftypes.h, src/autofit/aflatin.c, src/autofit/afcjk.c:
Updated.
2012-07-03 11:54:12 +02:00
Alexei Podtelezhnikov b25265c5e4 Avoid modulo operators against a power-of-two denominator.
* src/afcjk.c (af_hint_normal_stem), src/base/ftoutln.c
(ft_contour_has), src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_vvcurveto, cff_op_hhcurveto, cff_op_hvcurveto>,
src/gxvalid/gxvcommn.c (GXV_32BIT_ALIGNMENT_VALIDATE),
src/gxvalid/gxvfeat.c (gxv_feat_setting_validate): Replace `%' with
`&' operator.
2012-02-29 13:45:24 +01:00
Werner Lemberg c52f44d4fd Whitespace. 2011-11-30 10:46:53 +01:00
Werner Lemberg 71cc1a83d8 Fix gcc 4.6 compiler warnings.
* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Use casts and
remove unused variables.
* src/autofit/aflatin.c (af_latin_hints_compute_edges): Comment out
`up_dir'.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `height_org'
and `width_org' conditionalized.
2011-05-30 07:20:37 +02:00
sssa 4e8f9de9a0 [autofit] Make trace message for CJK bluezone more verbose. 2011-05-12 14:30:15 +09:00
Werner Lemberg 27b20e9a1e Formatting, minor doc improvements. 2011-05-09 09:48:49 +02:00
suzuki toshiya 084abf0469 [autofit] Add bluezones for CJK Ideographs.
To remove extremas of vertical strokes of CJK Ideographs at
low resolution and make the top and bottom horizontal stems
aligned, bluezones for CJK Ideographs are calculated from
sample glyphs.  At present, vertical bluezones (bluezones
to align vertical stems) are disabled by default.  For detail, see
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html
http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html

* include/freetype/internal/fttrace.h: New trace component `afcjk'.
* src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version
for AF_Latin{Blue,Axis,Metric}Rec.
(af_cjk_metrics_check_digits): Ditto, shared with Indic module.
(af_cjk_metrics_init_widths): Ditto.
(af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric.
(af_cjk_metrics_scale): Ditto (declaration).
(af_cjk_hints_init): Ditto (declaration).
(af_cjk_hints_apply): Ditto (declaration).
* src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body).
(af_cjk_hints_init): Ditto (body).
(af_cjk_hints_apply): Ditto (body).
(af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths.
(af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits.
(af_cjk_metrics_init): Call CJK bluezone initializer.
(af_cjk_metrics_scale_dim): Add code to scale bluezones.
(af_cjk_hints_compute_blue_edges): New function, CJK version of
af_latin_hints_compute_blue_edges.
(af_cjk_metrics_init_blues): New function, CJK version of
af_latin_metrics_init_blues.
(af_cjk_hints_edges): Add code to align the edge stems to blue zones.

* src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric
instead of AF_LatinMetric, and initialize as af_cjk_metrics_init.
However bluezones are not initialized.
(af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric.
(af_indic_hints_init): Ditto.
(af_indic_hints_apply): Ditto.

* docs/CHANGES: Note about CJK bluezone support.
2011-05-08 19:22:32 +09:00
suzuki toshiya a345c0e1d5 [autofit] Blur CJK stems if too many to preserve their gaps 2011-04-21 10:58:33 +09:00
Werner Lemberg 7f03a2465c Update Unicode ranges for CJK autofitter; in particular, add Hangul.
* src/autofit/afcjk.c (af_cjk_uniranges): Update to Unicode 6.0.
2011-04-07 07:20:38 +02:00
Werner Lemberg c7f26a1982 C++ compilation fixes.
* src/autofit/aflatin.c (af_latin_hints_apply), src/autofit/afcjk.c
(af_cjk_hints_apply): Use cast for `dim'.
2011-03-19 02:28:21 +01:00
Werner Lemberg 576fc2c06e Add AF_CONFIG_OPTION_USE_WARPER to control the autofit warper.
* devel/ftoption.h, include/freetype/config/ftoption.h
(AF_CONFIG_OPTION_USE_WARPER): New macro.
* src/autofit/aftypes.h (AF_USE_WARPER): Remove.

* src/autofit/*: s/AF_USE_WARPER/AF_CONFIG_OPTION_USE_WARPER/.

* src/autofit/afwarp.c [!AF_CONFIG_OPTION_USE_WARPER]: Replace dummy
variable assignment with a typedef.
2011-03-02 03:52:36 +01:00
Werner Lemberg 09344385ee autofit: Remove dead code.
Suggested by Graham.

* src/autofit/afhints.c (af_glyph_hints_compute_inflections):
Removed.
(af_glyph_hints_reload): Remove third argument.
Update all callers.
2010-05-22 07:43:22 +02:00
suzuki toshiya b56680240a autofit: Count the size of the memory object by ptrdiff_t. 2009-08-01 00:32:07 +09:00
suzuki toshiya 38e480b4c6 autofit: Improve Unicode range definitions. 2009-08-01 00:30:21 +09:00
Werner Lemberg 8b84c9d19f autohinter: Don't change digit widths if all widths are the same.
This fixes FreeDesktop bug #21197.

* src/autofit/afglobal.c (AF_DIGIT): New macro.
(af_face_globals_compute_script_coverage): Mark ASCII digits in
`glyph_scripts' array.
(af_face_globals_get_metrics): Updated.
(af_face_globals_is_digit): New function.
* src/autofit/afglobal.h: Updated.
(AF_ScriptMetricsRec): Add `digits_have_same_width' flag.

* src/autofit/aflatin.c: Include FT_ADVANCES_H.
(af_latin_metrics_check_digits): New function.
(af_latin_metrics_init): Use it.
* src/autofit/aflatin.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init): Updated.

* src/autofit/aflatin2.c: Similar changes as with aflatin.c.

* src/autofit/afloader.c (af_loader_load_g): Test digit width.

* docs/CHANGES: Document it.
2009-04-27 19:40:35 +02:00
Oran Agra 59b4af8d59 Position Independent Code (PIC) support in autofit module.
* include/freetype/internal/autohint.h add macros to init
instances of FT_AutoHinter_ServiceRec.

* src/autofit/afmodule.h declare autofit_module_class
using macros from ftmodapi.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined
af_autofitter_service and autofit_module_class structs
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from afpic.h in order to access them.

* src/autofit/aftypes.h add macros to init and declare
instances of AF_ScriptClassRec.

* src/autofit/afcjk.h declare af_cjk_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined
af_cjk_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/afdummy.h declare af_dummy_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined
af_dummy_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/afindic.h declare af_indic_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined
af_indic_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/aflatin.h declare af_latin_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined
af_latin_script_class struct will have function to init it instead of
being allocated in the global scope.
Change af_latin_blue_chars to be PIC-compatible by being a two
dimentional array rather than array of pointers.


* src/autofit/aflatin2.h declare af_latin2_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined
af_latin2_script_class struct will have function to init it instead of
being allocated in the global scope.
Change af_latin2_blue_chars to be PIC-compatible by being a two
dimentional array rather than array of pointers.

* src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined
af_script_classes array initialization was moved to afpic.c and
is later refered using macros defeined in afpic.h.

New Files:
* src/autofit/afpic.h declare struct to hold PIC globals for autofit
module and macros to access them.
* src/autofit/afpic.c implement functions to allocate, destroy and
initialize PIC globals for autofit module.

* src/autofit/autofit.c add new file to build: afpic.c.
* src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
2009-04-05 18:23:38 +03:00
Werner Lemberg b6fa845146 * src/autofit/aflatin.c (af_latin_hint_edges),
src/autofit/aflatin2.c (af_latin2_hint_edges), src/autofit/afcjk.c
(af_cjk_hint_edges): Protect against division by zero.
2008-12-21 09:46:31 +00:00
Werner Lemberg 1a5d561dce * src/autofit/afcjk.c, src/base/ftoutln.c, src/base/ftrfork.c,
src/bdf/bdfdrivr.c, src/gxvalid/gxvmorx.c, src/otvalid/otvmath.c,
src/pcf/pcfdrivr.c, src/psnames/pstables.h, src/smooth/ftgrays.c,
src/tools/glnames.py, src/truetype/ttinterp.c, src/type1/t1load.c,
src/type42/t42objs.c, src/winfonts/winfnt.c: Fix compiler warnings
(Atari PureC).
2008-11-29 22:50:24 +00:00
Werner Lemberg 1e1b6dff54 * src/pfr/pfrcmap.c: Include pfrerror.h.
* src/autofit/afindic.c: Add some external declarations to pacify
`make multi' compilation.

* src/cid/cidgload.c (cid_load_glyph): Pacify compiler.

* src/cff/cffdrivr.c (cff_ps_get_font_info), src/cff/cffobjs.c
(cff_strcpy), include/freetype/internal/ftmemory.h (FT_MEM_STRDUP),
src/autofit/aflatin.c (af_latin_hints_compute_edges),
src/autofit/afcjk.c (af_cjk_hints_compute_edges), src/sfnt/ttmtx.c
(tt_face_get_metrics), src/base/ftobjs.c (open_face)
[FT_CONFIG_OPTION_INCREMENTAL]: Fix compilation with C++ compiler.

* docs/release: Mention test compilation targets.
2007-07-07 07:30:40 +00:00
David Turner b792017faf experimental changes for the Latin auto-hinter.
note that the new code is disabled by default.
2007-06-11 05:37:35 +00:00
Werner Lemberg 607dec79bb * src/autofit/afcjk.c (af_cjk_hints_compute_edges): Remove unused
variable.
* src/autofit/afloader.c (af_loader_load_g): Ditto.

* src/base/ftobjs.c (ft_validator_error): Use `ft_jmp_buf'.
(open_face_from_buffer): Initialize `stream'.
(FT_Request_Metrics): Remove unused variable.
Remove redundant `break' statements.
(FT_Get_Track_Kerning): Remove unused variable.

* src/psaux/afmparse.c (afm_parse_track_kern, afm_parse_kern_pairs,
afm_parse_kern_data): Remove redundant
`break' statements.
(afm_parser_parse): Ditto.
Don't use uninitialized variables.

* src/psnames/psmodule.c (VARIANT_BIT): Define as unsigned long.
Use `|' operator instead of `^' to set it.
Update all users.

* src/sfnt/ttcmap.c (tt_face_build_cmaps): Use `ft_jmp_buf'.
* src/sfnt/ttkern.c (tt_face_load_kern): Remove unused variable.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Remove redundant
comparison.
(TT_Process_Simple_Glyph): Use FT_UInt for `n_points' and `i'.
(TT_Load_Glyph): Remove unused variable.
2007-05-15 06:49:37 +00:00
Werner Lemberg 545c4e566e * src/truetype/ttgload.c (TT_Load_Composite_Glyph)
[FT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again.


Formatting, documentation fixes.
2006-05-17 22:55:04 +00:00
David Turner 281679de85 * include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
        src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
        src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
        src/type1/t1gload.c:

          this is a major patch used to drastically improve the performance
          of loading glyphs. This both speeds up loading the glypn vector
          themselves and the auto-fitter.

          note that we've started using inline assembler with GCC to
          implement FT_MulFix, given that this function is so damn
          important for the engine's performance.

          the resulting speed-up is about 25%.
2006-05-17 13:34:21 +00:00
David Turner da95af6cf6 * builds/win32/visualc/freetype.dsp: updating the project file, adding
missing base source files (e.g. ftstroke.c, ftxf86.c, etc...)

    * src/autofit/afcjk.c, src/autofit/aflatin.c, src/base/ftobjs.c,
    src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrobjs.c,
    src/sfnt/sfobjs.c, src/sfnt/ttmtx.c, src/truetype/ttpload.c,
    src/truetype/ttpload.h, src/type1/t1afm.c, src/type1/t1objs.c:
      removing compiler warnings when building with Visual C++ 6 and /W4
2006-03-20 13:32:33 +00:00
David Turner 6c71c6b968 * include/freetype/config/ftoption.h, src/autofit/afcjk.c,
src/base/ftobjs.c, src/base/ftutil.c, src/cff/cffobjs.c,
    src/psaux/afmparse.c, src/sfnt/ttbdf.c, src/tools/apinames.c,
    src/truetype/ttdriver.c:

       solved compiler warnings as well as C++ compilation problems
2006-02-25 12:49:40 +00:00
Werner Lemberg 5225402a52 * include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in
documentation that negative strength values are possible.
Give an example call.

* include/freetype/freetype.h (FT_GlyphSlotRec): Improve
documentation of `outline' field.

* src/sfnt/sfobjc.s: Inckude FT_INTERNAL_DEBUG_H.
* src/sfnt/sfdriver.c: Include ttmtx.h.

* src/autofit/afcjk.c: Include aftypes.h and aflatin.h.
2006-02-15 06:05:52 +00:00
Wu, Chia-I (吳佳一) 4c507ffa80 * src/autofit/afcjk.c (af_cjk_metrics_init): Fix a stupid bug...
* src/autofit/aflatin.c (af_latin_metrics_init_widths): Use
AF_LatinMetricsRec as the dummy metrics because we cast the metrics to
it later in `af_latin_hints_link_segments'.
2006-02-11 13:22:37 +00:00
Wu, Chia-I (吳佳一) f9a69132a7 * include/freetype/config/ftoption.h (AF_CONFIG_OPTION_CJK): #define
to enable autofit CJK script support. (#define'd by default)

* src/autofit/aflatin.h (AF_LATIN_CONSTANT): New macro.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Make sure that
`edge_distance_threshold' is always set.
(af_latin_hints_link_segments): Potential divide by 0 bug.
Use latin constant in the scoring formula.

* src/autofit/afcjk.c: Minor updates due to the above three changes.

* docs/TODO, docs/CHANGES: Updated.
2006-02-11 12:12:02 +00:00
Werner Lemberg d1d4bffe2f formatting 2006-02-10 22:15:22 +00:00
Wu, Chia-I (吳佳一) 4cdb45c01e Introduce experimental autofit CJK module based on akito's autohint
patch.  You need to #define AF_MOD_CJK in afcjk.c to enable it.

* src/autofit/afglobal.c, src/autofit/afcjk.h, src/autofit/afcjk.c,
src/autofit/rules.mk, src/autofit/autofit.c, src/autofit/aftypes.h:
Add CJK module based on akito's autohint patch.

* src/autofit/afhints.h (AF_SegmentRec): New field `len' for the
overlap length of the segments.  (AF_SEGMENT_LEN, AF_SEGMENT_DIST):
New macros.

* src/autofit/aflatin.h (af_latin_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Made `FT_LOCAL'.
Use the character given by the caller.
(af_latin_metrics_init_widths, af_latin_hints_link_segments): Scale
the thresholds.

* src/autofit/afloader.c (af_loader_load_g): Respect
AF_SCALER_FLAG_NO_ADVANCE.
2006-02-09 14:17:04 +00:00