About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ttgload.c File Reference
#include <ft2build.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/sfnt.h>
#include <freetype/tttags.h>
#include <freetype/ftoutln.h>
#include <freetype/ftdriver.h>
#include <freetype/ftlist.h>
#include "ttgload.h"
#include "ttpload.h"
#include "tterrors.h"
#include "ttsubpix.h"
Include dependency graph for ttgload.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define FT_COMPONENT   ttgload
#define ON_CURVE_POINT   0x01 /* same value as FT_CURVE_TAG_ON */
#define X_SHORT_VECTOR   0x02
#define Y_SHORT_VECTOR   0x04
#define REPEAT_FLAG   0x08
#define X_POSITIVE   0x10 /* two meanings depending on X_SHORT_VECTOR */
#define SAME_X   0x10
#define Y_POSITIVE   0x20 /* two meanings depending on Y_SHORT_VECTOR */
#define SAME_Y   0x20
#define OVERLAP_SIMPLE   0x40 /* retained as FT_OUTLINE_OVERLAP */
#define ARGS_ARE_WORDS   0x0001
#define ARGS_ARE_XY_VALUES   0x0002
#define ROUND_XY_TO_GRID   0x0004
#define WE_HAVE_A_SCALE   0x0008
#define MORE_COMPONENTS   0x0020
#define WE_HAVE_AN_XY_SCALE   0x0040
#define WE_HAVE_A_2X2   0x0080
#define WE_HAVE_INSTR   0x0100
#define USE_MY_METRICS   0x0200
#define OVERLAP_COMPOUND   0x0400 /* retained as FT_OUTLINE_OVERLAP */
#define IS_DEFAULT_INSTANCE(_face)   1


 TT_Get_HMetrics (TT_Face face, FT_UInt idx, FT_Short *lsb, FT_UShort *aw)
 TT_Get_VMetrics (TT_Face face, FT_UInt idx, FT_Pos yMax, FT_Short *tsb, FT_UShort *ah)
static FT_Error tt_get_metrics (TT_Loader loader, FT_UInt glyph_index)
 TT_Access_Glyph_Frame (TT_Loader loader, FT_UInt glyph_index, FT_ULong offset, FT_UInt byte_count)
 TT_Forget_Glyph_Frame (TT_Loader loader)
 TT_Load_Glyph_Header (TT_Loader loader)
 TT_Load_Simple_Glyph (TT_Loader load)
 TT_Load_Composite_Glyph (TT_Loader loader)
 TT_Init_Glyph_Loading (TT_Face face)
static void tt_prepare_zone (TT_GlyphZone zone, FT_GlyphLoad load, FT_UInt start_point, FT_UInt start_contour)
static FT_Error TT_Hint_Glyph (TT_Loader loader, FT_Bool is_composite)
static FT_Error TT_Process_Simple_Glyph (TT_Loader loader)
static FT_Error TT_Process_Composite_Component (TT_Loader loader, FT_SubGlyph subglyph, FT_UInt start_point, FT_UInt num_base_points)
static FT_Error TT_Process_Composite_Glyph (TT_Loader loader, FT_UInt start_point, FT_UInt start_contour)
static void tt_loader_set_pp (TT_Loader loader)
static FT_ListNode ft_list_get_node_at (FT_List list, FT_UInt idx)
static FT_Error load_truetype_glyph (TT_Loader loader, FT_UInt glyph_index, FT_UInt recurse_count, FT_Bool header_only)
static FT_Error compute_glyph_metrics (TT_Loader loader, FT_UInt glyph_index)
static FT_Error tt_loader_init (TT_Loader loader, TT_Size size, TT_GlyphSlot glyph, FT_Int32 load_flags, FT_Bool glyf_table_only)
static void tt_loader_done (TT_Loader loader)
 TT_Load_Glyph (TT_Size size, TT_GlyphSlot glyph, FT_UInt glyph_index, FT_Int32 load_flags)

Macro Definition Documentation


#define ARGS_ARE_WORDS   0x0001

Composite glyph flags.

Definition at line 70 of file ttgload.c.


#define ARGS_ARE_XY_VALUES   0x0002

Definition at line 71 of file ttgload.c.


#define FT_COMPONENT   ttgload


TrueType Glyph Loader (body).

Copyright (C) 1996-2020 by 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. The macro FT_COMPONENT is used in trace mode. It is an implicit parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log messages during execution.

Definition at line 48 of file ttgload.c.


#define IS_DEFAULT_INSTANCE (   _face)    1

Definition at line 90 of file ttgload.c.


#define MORE_COMPONENTS   0x0020

Definition at line 75 of file ttgload.c.


#define ON_CURVE_POINT   0x01 /* same value as FT_CURVE_TAG_ON */

Simple glyph flags.

Definition at line 55 of file ttgload.c.


#define OVERLAP_COMPOUND   0x0400 /* retained as FT_OUTLINE_OVERLAP */

Definition at line 80 of file ttgload.c.


#define OVERLAP_SIMPLE   0x40 /* retained as FT_OUTLINE_OVERLAP */

Definition at line 63 of file ttgload.c.


#define REPEAT_FLAG   0x08

Definition at line 58 of file ttgload.c.


#define ROUND_XY_TO_GRID   0x0004

Definition at line 72 of file ttgload.c.


#define SAME_X   0x10

Definition at line 60 of file ttgload.c.


#define SAME_Y   0x20

Definition at line 62 of file ttgload.c.



Definition at line 81 of file ttgload.c.



Definition at line 82 of file ttgload.c.


#define USE_MY_METRICS   0x0200

Definition at line 79 of file ttgload.c.


#define WE_HAVE_A_2X2   0x0080

Definition at line 77 of file ttgload.c.


#define WE_HAVE_A_SCALE   0x0008

Definition at line 73 of file ttgload.c.


#define WE_HAVE_AN_XY_SCALE   0x0040

Definition at line 76 of file ttgload.c.


#define WE_HAVE_INSTR   0x0100

Definition at line 78 of file ttgload.c.


#define X_POSITIVE   0x10 /* two meanings depending on X_SHORT_VECTOR */

Definition at line 59 of file ttgload.c.


#define X_SHORT_VECTOR   0x02

Definition at line 56 of file ttgload.c.


#define Y_POSITIVE   0x20 /* two meanings depending on Y_SHORT_VECTOR */

Definition at line 61 of file ttgload.c.


#define Y_SHORT_VECTOR   0x04

Definition at line 57 of file ttgload.c.

Function Documentation

◆ compute_glyph_metrics()

◆ ft_list_get_node_at()

static FT_ListNode ft_list_get_node_at ( FT_List  list,
FT_UInt  idx 

Definition at line 1570 of file ttgload.c.

References cur, idx, and NULL.

Referenced by load_truetype_glyph().

◆ load_truetype_glyph()

static FT_Error load_truetype_glyph ( TT_Loader  loader,
FT_UInt  glyph_index,
FT_UInt  recurse_count,
FT_Bool  header_only 

@Function: load_truetype_glyph

@Description: Loads a given truetype glyph. Handles composites and uses a TT_Loader object.

Definition at line 1601 of file ttgload.c.

References FT_SubGlyphRec_::arg1, FT_SubGlyphRec_::arg2, ARGS_ARE_XY_VALUES, FT_GlyphLoaderRec_::base, TT_LoaderRec_::bbox, TT_LoaderRec_::byte_len, TT_LoaderRec_::composites, TT_Outline_::contours, FT_GlyphLoaderRec_::current, FT_ListNodeRec_::data, endif, error, Exit(), TT_LoaderRec_::face, face, FALSE, FT_Outline_::flags, FT_SubGlyphRec_::flags, FT_GlyphSlotRec_::format, FT_Bool, FT_Err_Ok, FT_FACE, FT_FREE, FT_GLYPH_FORMAT_COMPOSITE, FT_GlyphLoader_Add(), FT_IS_NAMED_INSTANCE, FT_IS_VARIATION, FT_List_Add(), FT_List_Find(), ft_list_get_node_at(), FT_LOAD_NO_RECURSE, FT_LOAD_NO_SCALE, FT_MulFix(), FT_NEW, FT_NEW_ARRAY, FT_OUTLINE_OVERLAP, FT_PIX_ROUND, FT_SET_ERROR, FT_Stream_OpenMemory(), FT_THROW, FT_TRACE1, FT_TRACE2, FT_TRACE5, FT_UINT_TO_POINTER, FT_ULONG_MAX, FT_ZERO, TT_LoaderRec_::gloader, TT_LoaderRec_::glyph, TT_LoaderRec_::glyph_index, glyph_index, i, if, FT_SubGlyphRec_::index, TT_LoaderRec_::ins_pos, FT_FaceRec_::internal, IS_HINTED, FT_Data_::length, limit, TT_LoaderRec_::linear, TT_LoaderRec_::load_flags, FT_FaceRec_::memory, TT_SizeRec_::metrics, n, FT_Outline_::n_contours, TT_LoaderRec_::n_contours, TT_Outline_::n_contours, FT_Outline_::n_points, TT_Outline_::n_points, FT_ListNodeRec_::next, NULL, FT_FaceRec_::num_glyphs, FT_GlyphLoadRec_::num_subglyphs, offset, FT_GlyphLoadRec_::outline, outline, OVERLAP_COMPOUND, FT_Data_::pointer, TT_Outline_::points, points, pp, TT_LoaderRec_::pp1, TT_LoaderRec_::pp2, TT_LoaderRec_::pp3, TT_LoaderRec_::pp4, gen-indic-table::short, TT_LoaderRec_::size, TT_LoaderRec_::stream, FT_GlyphLoadRec_::subglyphs, tags, TT_FACE_FLAG_VAR_HADVANCE, TT_FACE_FLAG_VAR_VADVANCE, tt_face_get_location(), tt_get_metrics(), tt_loader_set_pp(), TT_Process_Composite_Component(), TT_Process_Composite_Glyph(), TT_Process_Simple_Glyph(), TT_USE_BYTECODE_INTERPRETER, USE_MY_METRICS, TT_LoaderRec_::vadvance, WE_HAVE_INSTR, FT_Vector_::x, cordic::x, FT_Size_Metrics_::x_scale, FT_BBox_::xMax, FT_BBox_::xMin, FT_Vector_::y, y, FT_Size_Metrics_::y_scale, y_scale, FT_BBox_::yMax, and FT_BBox_::yMin.

Referenced by TT_Load_Glyph().

◆ TT_Access_Glyph_Frame()

TT_Access_Glyph_Frame ( TT_Loader  loader,
FT_UInt  glyph_index,
FT_ULong  offset,
FT_UInt  byte_count 

The following functions are used by default with TrueType fonts. However, they can be replaced by alternatives if we need to support TrueType-compressed formats (like MicroType) in the future.

Definition at line 291 of file ttgload.c.

References error, FT_Err_Ok, FT_FRAME_ENTER, FT_STREAM_SEEK, FT_UNUSED, glyph_index, and offset.

Referenced by TT_Init_Glyph_Loading().

◆ TT_Forget_Glyph_Frame()

TT_Forget_Glyph_Frame ( TT_Loader  loader)

Definition at line 314 of file ttgload.c.

References FT_FRAME_EXIT.

Referenced by TT_Init_Glyph_Loading().

◆ TT_Get_HMetrics()

TT_Get_HMetrics ( TT_Face  face,
FT_UInt  idx,
FT_Short lsb,
FT_UShort aw 

Return the horizontal metrics in font units for a given glyph.

Definition at line 99 of file ttgload.c.

References face, FT_TRACE5, and idx.

Referenced by tt_get_metrics(), and TT_Load_Glyph().

◆ tt_get_metrics()

◆ TT_Get_VMetrics()

TT_Get_VMetrics ( TT_Face  face,
FT_UInt  idx,
FT_Pos  yMax,
FT_Short tsb,
FT_UShort ah 

Return the vertical metrics in font units for a given glyph. See function ‘tt_loader_set_pp’ below for explanations.

Definition at line 117 of file ttgload.c.

References face, FT_ABS, FT_TRACE5, and idx.

Referenced by tt_get_metrics(), and TT_Load_Glyph().

◆ TT_Hint_Glyph()

◆ TT_Init_Glyph_Loading()

TT_Init_Glyph_Loading ( TT_Face  face)


TrueType Glyph Loader (specification).

Copyright (C) 1996-2020 by 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.

Definition at line 779 of file ttgload.c.

References face, TT_Access_Glyph_Frame(), TT_Forget_Glyph_Frame(), TT_Load_Composite_Glyph(), TT_Load_Glyph_Header(), and TT_Load_Simple_Glyph().

Referenced by tt_face_init().

◆ TT_Load_Composite_Glyph()

◆ TT_Load_Glyph()

TT_Load_Glyph ( TT_Size  size,
TT_GlyphSlot  glyph,
FT_UInt  glyph_index,
FT_Int32  load_flags 

@Function: TT_Load_Glyph

@Description: A function used to load a single glyph within a given glyph slot, for a given size.

@Input: glyph :: A handle to a target slot object where the glyph will be loaded.

size :: A handle to the source face size at which the glyph must be scaled/loaded.

glyph_index :: The index of the glyph in the font file.

load_flags :: A flag indicating what to load for this glyph. The FT_LOAD_XXX constants can be used to control the glyph loading process (e.g., whether the outline should be scaled, whether to load bitmaps or not, whether to hint the outline, etc).

@Return: FreeType error code. 0 means success.

Definition at line 2807 of file ttgload.c.

References FT_GlyphLoaderRec_::base, glyph::bitmap, compute_glyph_metrics(), error, TT_LoaderRec_::exec, Exit(), face, FALSE, glyph::flags, FT_ERR_EQ, FT_Err_Ok, FT_GLYPH_FORMAT_BITMAP, FT_GLYPH_FORMAT_COMPOSITE, FT_GLYPH_FORMAT_OUTLINE, FT_IS_SCALABLE, FT_LOAD_NO_BITMAP, FT_LOAD_NO_SCALE, FT_LOAD_SBITS_ONLY, FT_MulFix(), FT_OUTLINE_HIGH_PRECISION, FT_OUTLINE_IGNORE_DROPOUTS, FT_OUTLINE_INCLUDE_STUBS, FT_OUTLINE_SMART_DROPOUTS, FT_Outline_Translate(), FT_PIXEL_MODE_MONO, FT_THROW, FT_TRACE1, TT_LoaderRec_::gloader, glyph_index, TT_ExecContextRec_::GS, glyph::height, if, IS_DEFAULT_INSTANCE, IS_HINTED, TT_LoaderRec_::linear, load_truetype_glyph(), FT_GlyphLoadRec_::num_subglyphs, FT_GlyphLoadRec_::outline, TT_LoaderRec_::pp1, TT_GraphicsState_::scan_control, TT_GraphicsState_::scan_type, size, FT_GlyphLoadRec_::subglyphs, TRUE, TT_Get_HMetrics(), TT_Get_VMetrics(), tt_loader_done(), tt_loader_init(), TT_LoaderRec_::vadvance, void, glyph::width, FT_Vector_::x, and y_scale.

Referenced by GPOS_Create(), LoadTrueTypeChar(), and tt_glyph_load().

◆ TT_Load_Glyph_Header()

TT_Load_Glyph_Header ( TT_Loader  loader)

Definition at line 324 of file ttgload.c.

References FT_Err_Ok, FT_NEXT_SHORT, FT_THROW, FT_TRACE5, limit, and p.

Referenced by TT_Init_Glyph_Loading().

◆ TT_Load_Simple_Glyph()

◆ tt_loader_done()

static void tt_loader_done ( TT_Loader  loader)

◆ tt_loader_init()

◆ tt_loader_set_pp()

◆ tt_prepare_zone()

static void tt_prepare_zone ( TT_GlyphZone  zone,
FT_GlyphLoad  load,
FT_UInt  start_point,
FT_UInt  start_contour 

Definition at line 790 of file ttgload.c.

References load.

Referenced by TT_Process_Composite_Glyph(), and TT_Process_Simple_Glyph().

◆ TT_Process_Composite_Component()

◆ TT_Process_Composite_Glyph()

◆ TT_Process_Simple_Glyph()