Commit Graph

157 Commits

Author SHA1 Message Date
Werner Lemberg 930e9bf8f4 Add new error code FT_Err_Missing_Module.
Previously, FreeType misleadingly returned
FT_Err_Unknown_File_Format if a module was missing (or a test was
missing completely).

* include/freetype/fterrdef.h (FT_Err_Missing_Module): Define.

* src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
(cid_face_init), src/sfnt/sfobjs.c (sfnt_init_face),
src/truetype/ttobjs.c (tt_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init,
T42_Driver_Init): Updated.

* src/type1/t1afm.c (T1_Read_Metrics), src/type/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Remove now
redundant test for `psaux'.
2011-11-26 13:38:26 +01:00
Werner Lemberg f095744d2d [sfnt] Try harder to find non-zero values for ascender and descender.
* src/sfnt/sfobjs.c (sfnt_load_face): Consult `OS/2' table in case
the `hhea' table's values are zero.
2011-07-07 14:10:39 +02:00
Werner Lemberg b511999601 Whitespace. 2011-07-03 09:46:32 +02:00
Werner Lemberg af7b8b1a9f * src/sfnt/sfobjs.c (sfnt_open_font): Check number of TTC subfonts. 2011-03-20 07:51:57 +01:00
Werner Lemberg fa764cf868 [sfnt] Ignore all errors while loading `OS/2' table.
Suggested by Johnson Y. Yan <yinsen_yan@foxitsoftware.com>.

* src/sfnt/sfobjs.c (sfnt_load_face): Do it.
2010-11-18 13:08:52 +01:00
Werner Lemberg c8f5b98be2 Remove C++ warnings.
*/*: Initialize pointers where necessary to make g++ happy.
2010-07-12 21:13:22 +02:00
suzuki toshiya 1e2a446d55 Capitalize ISO. 2010-07-09 22:14:35 +09:00
suzuki toshiya c9669a8a63 [sfnt] Fix memory leaks in previous patch. 2010-01-30 02:24:25 +09:00
suzuki toshiya 75852eda51 New parameters for FT_Open_Face() to ignore preferred family names. 2010-01-29 23:18:34 +09:00
suzuki toshiya 0105905052 sfnt: Fix a data type mismatching with its source. 2009-08-01 00:32:20 +09:00
Werner Lemberg c2cabd4291 Fix Savannah bug #25495.
* src/sfnt/sfobjs.c (sfnt_load_face): Test for bitmap strikes before
setting metrics and bbox values.  This ensures that the check for a
font with neither a `glyf' table nor bitmap strikes can be performed
early enough to set metrics and bbox values too.
2009-02-09 22:20:27 +00:00
Werner Lemberg 1ad384d881 Set `face_index' field in FT_Face for all font formats.
* cff/cffobjs.c (cff_face_init), winfonts/winfnt.c (FNT_Face_Init),
sfnt/sfobjs.c (sfnt_init_face): Do it.

* docs/CHANGES: Document it.
2008-12-25 23:52:00 +00:00
Werner Lemberg 3c5ad95166 * src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/cache/ftcmanag.c,
src/smooth/ftgrays.c, src/base/ftobjc.s, src/sfobjs.c:
s/_Err_Bad_Argument/_Err_Invalid_Argument/.  The former is for
errors in the bytecode interpreter only.
2008-12-21 17:51:12 +00:00
Werner Lemberg 1474f439b5 Really fix Savannah bug #25010: An SFNT font with neither outlines
nor bitmaps can be considered as containing space `glyphs' only.

* src/truetype/ttpload.c (tt_face_load_loca): Handle the case where
a `glyf' table is missing.

* src/truetype/ttgload.c (load_truetype_glyph): Abort if we have no
`glyf' table but a non-zero `loca' entry.
(tt_loader_init): Handle missing `glyf' table.

* src/base/ftobjs.c (FT_Load_Glyph): Undo change 2008-12-05.

* src/sfnt/sfobjs.c (sfnt_load_face): A font with neither outlines
nor bitmaps is scalable.
2008-12-09 06:51:56 +00:00
Werner Lemberg 76fffcd898 * include/freetype/freetype.h (FT_LOAD_ADVANCE_ONLY): Use value
0x100 instead of 0x10000; the latter value is already occupied by
FT_LOAD_TARGET_LIGHT.  Bug reported by James Cloos.


Handle SFNT with neither outlines nor bitmaps.  This fixes Savannah
bug #25010.

* src/base/ftobjs.c (FT_Load_Glyph): Reject fonts with neither
outlines nor bitmaps.

* src/sfnt/sfobjs.c (sfnt_load_face): Don't return an error if there
is no table with glyphs.


* src/sfnt/ttload.c (tt_face_lookup_table): Improve debugging
message.


Other minor cosmetics.
2008-12-05 18:37:44 +00:00
Werner Lemberg 02197280b4 Formatting. 2008-11-29 09:31:44 +00:00
Werner Lemberg e7aad0254c * src/sfnt/sfobjs.c (sfnt_load_face): Remove #if 0/#endif guards
since OpenType version 1.5 has been released.

* include/ttnameid.h (TT_NAME_ID_WWS_FAMILY,
TT_NAME_ID_WWS_SUBFAMILY): New macros for OpenType 1.5.
(TT_URC_COPTIC, TT_URC_VAI, TT_URC_NKO, TT_URC_BALINESE,
TT_URC_PHAGSPA, TT_URC_NON_PLANE_0, TT_URC_PHOENICIAN,
TT_URC_TAI_LE, TT_URC_NEW_TAI_LUE, TT_URC_BUGINESE,
TT_URC_GLAGOLITIC, TT_URC_YIJING, TT_URC_SYLOTI_NAGRI,
TT_URC_LINEAR_B, TT_URC_ANCIENT_GREEK_NUMBERS, TT_URC_UGARITIC,
TT_URC_OLD_PERSIAN, TT_URC_SHAVIAN, TT_URC_OSMANYA,
TT_URC_CYPRIOT_SYLLABARY, TT_URC_KHAROSHTHI, TT_URC_TAI_XUAN_JING,
TT_URC_CUNEIFORM, TT_URC_COUNTING_ROD_NUMERALS, TT_URC_SUNDANESE,
TT_URC_LEPCHA, TT_URC_OL_CHIKI, TT_URC_SAURASHTRA, TT_URC_KAYAH_LI,
TT_URC_REJANG, TT_URC_CHAM, TT_URC_ANCIENT_SYMBOLS,
TT_URC_PHAISTOS_DISC, TT_URC_OLD_ANATOLIAN, TT_URC_GAME_TILES): New
macros for OpenType 1.5.
2008-11-08 22:00:55 +00:00
Werner Lemberg 9512092859 * src/sfnt/sfobjs.c (tt_face_get_name): Modified to return an error
code so that memory allocation problems can be distinguished from
missing table entries.  Reported by Graham Asher.
(GET_NAME): New macro.
(sfnt_load_face): Use it.
2008-11-08 07:20:25 +00:00
Werner Lemberg 5d64257340 add comment 2008-10-15 13:20:17 +00:00
Werner Lemberg 174b8de328 * src/sfnt/sfobjs.c (sfnt_load_face): Fix computation of
`underline_position'.


* docs/CHANGES: Updated.


Formatting, minor editing.
2008-10-12 11:47:29 +00:00
Werner Lemberg 570b1fdb84 formatting 2008-10-05 06:08:40 +00:00
Suzuki, Toshiya (鈴木俊哉) 2d3e0af942 * `FT_Open_Face' tries `open_face_PS_from_sfnt_stream' when a sfnt container is found but not OpenType. 2008-10-05 02:38:57 +00:00
Werner Lemberg ce1bad0381 * src/sfnt/sfobjs.c (sfnt_load_face): `psnames_error' is only needed
if TT_CONFIG_OPTION_POSTSCRIPT_NAMES is defined.
2008-10-01 22:46:26 +00:00
Werner Lemberg d03d856d95 * src/truetype/ttobjs.c (tt_face_done), src/cff/cffobjs.c
(cff_face_done), src/pfr/pfrobjs.c (pfr_face_done),
src/pcf/pcfdrivr.c (PCF_Face_Done), src/cid/cidobjs.c
(cid_face_done), src/bdf/bdfdrivr. (BDF_Face_Done),
src/sfnt/sfobjs.c (sfnt_face_done): Protect against face == 0.
Reported by Graham Asher.
2008-10-01 22:39:05 +00:00
Suzuki, Toshiya (鈴木俊哉) 7981fe2a0f * src/sfnt/sfobjs.c (sfnt_open_font): Use TTAG_OTTO 2008-08-29 06:09:03 +00:00
Werner Lemberg 2b0b4221ab Cosmetic code changes. 2008-05-28 22:17:28 +00:00
Werner Lemberg d503fc57f2 * src/sfnt/sfobjs.c (sfnt_done_face): Check `sfnt' everywhere. This
fixes Savannah bug #21485.
2007-11-01 09:19:44 +00:00
Werner Lemberg 7d9c189ac2 * src/sfnt/sfobjs.c (sfnt_load_face): Support bit 9 and prepare
support for bit 8 in the `OS/2' table.  MS is already using this;
hopefully, this becomes part of OpenType 1.5.
Prepare also support for `name' IDs 21 (WWS_FAMILY) and 22
(WWS_SUBFAMILY).
2007-10-21 08:12:30 +00:00
Werner Lemberg 33db39e292 * src/sfnt/sfobjs.c (sfnt_load_face): Undo change from 2007-04-28.
Fonts without a cmap must be handled correctly by FreeType (anything
else would be a bug).


* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
[FT_DEBUG_LEVEL_TRACE]: Improve tracing message.
2007-06-08 06:30:29 +00:00
Werner Lemberg 1b5267dad1 * src/sfnt/sfobjs.c (sfnt_load_face): Check error code after loading
`cmap'.
2007-04-28 21:06:15 +00:00
Werner Lemberg fcc1f472c3 * src/sfnt/sfobjs.c (sfnt_load_face) [FT_CONFIG_OPTION_INCREMENTAL]:
Ignore `hhea' table.  This fixes Savannah bug #19261.
2007-04-10 11:51:50 +00:00
Werner Lemberg 6e87ed9f04 Spelling fixes from Alexei. 2007-01-26 22:18:56 +00:00
Werner Lemberg 4ea0a7f0b6 formatting, minor doc fixes, copyright years 2007-01-05 09:03:31 +00:00
David Turner 8a6c44e673 Getting rid of the FT_OPTIMIZE_MEMORY macro, since the optimization
is no longer experimental
2007-01-04 17:03:11 +00:00
Werner Lemberg 6b87e6f0ff * src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt0_pairs_validate):
Remove compiler warning.

Formatting.
2007-01-02 19:20:08 +00:00
David Turner 9207e00198 adding documentation comment 2007-01-02 16:58:13 +00:00
Werner Lemberg 960ba59ad9 * src/sfnt/sfobjs.c (tt_face_get_name): All Unicode strings are
encoded in UTF-16BE.  Patch from Rajeev Pahuja <rpahuja@esri.com>.
(tt_name_entry_ascii_from_ucs4): Removed.


* include/freetype/ftxf86.h: Fix and extend comment so that it
appears in the documentation.

* include/freetype/ftchapters.h: Add `font_format' section.


* src/tools/docmaker/tohtml.py (HtmlFormatter::index_exit): Add link
to TOC in index page.


Formatting.
2006-12-01 08:20:47 +00:00
Werner Lemberg f9644559a8 formatting 2006-09-12 13:48:10 +00:00
David Turner f3050059dd * src/sfnt/sfobjs.c (tt_face_get_name): support some function
which report their English names through an Apple Roman
        (platform,encoding) pair, with language_id != English

        if the font uses another name entry with language_id == English,
        it will be selected correctly though.

        * src/truetype/ttobjs.c: add unpatent-hinting selection for
        "mingli.ttf"
2006-09-11 12:00:32 +00:00
Werner Lemberg 5a73d8d20f * builds/freetype.mk (CACHE_DIR, CACHE_H): Remove.
(FREETYPE_H): Updated.

* src/cache/rules.mk (CACHE_H_DIR): Remove.
(CACHE_DRV_H): Updated.

Formatting, copyright years.
2006-03-20 16:55:32 +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
Wu, Chia-I (吳佳一) facd9af542 * modules.cfg: Compile in ftotval.c and ftxf86.c by default for ABI
compatibility.

* src/sfnt/sfobjs.c (sfnt_done_face): Fix a memory leak.

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_bit_aligned,
tt_sbit_decoder_load_byte_aligned) [FT_OPTIMIZE_MEMORY]: Fix sbit
loading. (only tested with bit aligned sbit with x_pos == 0)

* src/truetype/ttpload.c (tt_face_load_hdmx,
tt_face_get_device_metrics) [FT_OPTIMIZE_MEMORY]: hdmx is not actually
used.
2006-02-22 07:59:35 +00:00
David Turner 1ae134a233 * src/sfnt/sfobjs.c (sfnt_face_load): fixed silly bug that
prevented embedded bitmaps from being correctly listed and used

    * src/pfr/pfrsbit.c: fixed handling of character advances
2006-02-21 16:50:17 +00:00
Wu, Chia-I (吳佳一) 0d565fdc1d * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove
unused `max_points' and `max_contours'.

* src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Update.

* include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused
`max_components'.

* src/truetype/ttinterp.h (TT_ExecContextRec): Remove unused
`loadSize' and `loadStack'.

* src/truetype/ttinterp.c (TT_Done_Context, TT_Load_Context),
src/sfnt/ttload.c (tt_face_load_maxp): Update.

* src/cff/cffobjs.h (cff_size_select), src/sfnt/sfdriver.c
(sfnt_interface), src/truetype/ttdriver.c (tt_size_request): Fix
compiler errors/warnings when TT_CONFIG_OPTION_EMBEDDED_BITMAPS is not
defined.

* src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_get_metrics): Fix
possible segment faults for the non-FT_OPTIMIZE_MEMORY'ed versions.
(finally!)

For most OpenType tables, `tt_face_load_xxxx' simply loads the table
and `face->root' is set later in `sfnt_load_face'.  Here, we try to
make this work for _all_ tables.

* src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c, src/sfnt/ttload.c,
src/sfnt/ttmtx.c: all `tt_face_load_xxxx' should load the table and
then exit.  Error handling or setting face->root is done later in
`sfnt_load_face'.
Pretty trace messages.

* src/sfnt/sfobjs.c (sfnt_load_face): Work harder.
Mac bitmap-only fonts are not scalable.
Check that `face->header.Units_Per_EM' is not zero.
(LOAD_, LOADM_): Pretty trace messages.

* src/sfnt/ttsbit0.c (tt_face_load_strike_metrics): Read metrics from
`eblc'.

* src/sfnt/ttcmap.c (tt_face_build_cmaps), src/sfnt/ttpost.c
(load_format_20, load_format_25, tt_face_get_ps_name): Use
face->max_profile.numGlyphs, instead of face->root.num_glyphs.
2006-02-15 07:44:31 +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 (吳佳一) 9a2b3b6d55 * src/sfnt/ttmtx.c (tt_face_load_hhea, tt_face_load_hmtx): Simply
return error if table is missing.
Check table length in non-FT_OPTIMIZE_MEMORY'ed `tt_face_load_hmtx'.

* src/sfnt/sfobjs.c (sfnt_load_face): Take care of missing metrics
tables.  The last change makes Mac bitmap-only font not load and this
fixes it.

* src/truetype/ttgload.c (load_truetype_glyph): Fix compilation error
when FT_CONFIG_OPTION_INCREMENTAL is defined.
2006-02-14 08:37:03 +00:00
Wu, Chia-I (吳佳一) 35222ff7bb Clean up the SFNT_Interface. In this final pass, `load_hmtx' is
splitted from `load_hhea'.

* include/freetype/internal/sfnt.h, src/sfnt/sfdriver.c,
src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Split `hmtx' from `hhea'.

* src/sfnt/sfobjs.c (sfnt_load_face): Update.
2006-02-14 07:25:57 +00:00
Wu, Chia-I (吳佳一) 65863a5712 Clean up the SFNT_Interface. In this pass, we want to treat the font
directory (offset table and table directory) as a normal table like
the others.  This also means that TTC is no longer recognized there,
but in `init_face'.

* include/freetype/internal/sfnt.h (SFNT_Interface),
src/sfnt/sfdriver.c: `load_sfnt_header' and `load_directory' are
combined and renamed to `load_font_dir'.

* src/sfnt/ttload.h, src/sfnt/ttload.c:
s/sfnt_dir_check/check_table_dir/.
`sfnt_init' is moved to sfobjs.c and renamed to `sfnt_open_font'.
`tt_face_load_sfnt_header' and `tt_face_load_directory' are combined
and renamed to `tt_face_load_font_dir'.

* src/sfnt/sfobjs.c (sfnt_init_face): Recognize TTC here.
2006-02-14 07:01:29 +00:00
Wu, Chia-I (吳佳一) f5aa47beb0 Clean up the SFNT_Interface. Table loading functions are now named
after the tables' tags;  `hdmx' is TrueType-specific and thus the code
is moved to the truetype module; `get_metrics' is moved here from the
truetype module so that the code can be shared with the cff module.

This pass involves no real changes.  That is, the code is moved
verbatim mostly.  The only exception is the return value of
`tt_face_get_metrics'.

* include/freetype/internal/sfnt.h, src/sfnt/rules.mk,
src/sfnt/sfdriver.c, src/sfnt/sfnt.c, src/sfnt/sfobjs.c,
src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttsbit.c,
src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: Clean up the SFNT_Interface.

* src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Metrics-related tables' loading
and parsing code is moved here.
Move `tt_face_get_metrics' here from the truetype module.  The return
value is changed from `void' to `FT_Error'.

* include/freetype/internal/fttrace.h: New trace: ttmtx.

* src/truetype/ttpload.c, src/truetype/ttpload.h: `hdmx' loading and
parsing code is moved here.
New function `tt_face_load_prep' splitted from `tt_face_load_fpgm'.
`tt_face_load_fpgm' returns `FT_Err_Ok' if `fpgm' doesn't exist.

* src/cff/cffgload.c, src/cff/cffobjs.c: Update.

* src/truetype/ttgload.c, src/truetype/ttobjs.c: Update.
2006-02-14 06:40:10 +00:00
Werner Lemberg be3c9814a4 Formatting, copyright years. 2006-01-27 14:16:16 +00:00