Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
FreeType
FreeType
Commits
994d7747
Commit
994d7747
authored
Jun 25, 2000
by
David Turner
Browse files
various hacks to the TrueType driver that I cannot
explain now, but they'll be very useful in the near future :-)
parent
2a98b3c4
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/freetype/internal/tttypes.h
View file @
994d7747
...
...
@@ -1053,6 +1053,8 @@
/* a function type used for the truetype bytecode interpreter hooks */
typedef
FT_Error
(
*
TT_Interpreter
)(
void
*
exec_context
);
/* forward declaration */
typedef
struct
TT_Loader_
TT_Loader
;
/*************************************************************************/
/* */
...
...
@@ -1082,6 +1084,70 @@
FT_Stream
stream
,
FT_ULong
*
length
);
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Access_Glyph_Frame */
/* */
/* <Description> */
/* Seeks a stream to the start of a given glyph element, and */
/* opens a frame for it.. */
/* */
/* <Input> */
/* loader :: the current TrueType glyph loader object */
/* glyph index :: index of glyph to access */
/* offset :: offset of glyph according to locations table */
/* byte_count :: size of frame in bytes */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* This function is normally equivalent to FILE_Seek(offset) */
/* followed by ACCESS_Frame(byte_count) with the loader's stream */
/* but alternative formats (compressed ones) might use something */
/* different.. */
/* */
typedef
FT_Error
(
*
TT_Access_Glyph_Frame_Func
)(
TT_Loader
*
loader
,
FT_UInt
glyph_index
,
FT_ULong
offset
,
FT_UInt
byte_count
);
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_Glyph_Element */
/* */
/* <Description> */
/* Reads one glyph element (its header, a simple glyph, or a */
/* composite) from the loader's current stream frame.. */
/* */
/* <Input> */
/* loader :: the current TrueType glyph loader object */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
typedef
FT_Error
(
*
TT_Load_Glyph_Element_Func
)(
TT_Loader
*
loader
);
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Forget_Frame_Element */
/* */
/* <Description> */
/* Closes the current loader stream frame for the glyph.. */
/* */
/* <Input> */
/* loader :: the current TrueType glyph loader object */
/* */
typedef
void
(
*
TT_Forget_Glyph_Frame_Func
)(
TT_Loader
*
loader
);
/*************************************************************************/
/* */
/* TrueType Face Type */
...
...
@@ -1276,6 +1342,12 @@
/* might need something different, e.g. Type 42 fonts */
TT_Goto_Table_Func
goto_table
;
TT_Access_Glyph_Frame_Func
access_glyph_frame
;
TT_Load_Glyph_Element_Func
read_glyph_header
;
TT_Load_Glyph_Element_Func
read_simple_glyph
;
TT_Load_Glyph_Element_Func
read_composite_glyph
;
TT_Forget_Glyph_Frame_Func
forget_glyph_frame
;
/* a typeless pointer to the SFNT_Interface table used to load */
/* the basic TrueType tables in the face object */
void
*
sfnt
;
...
...
@@ -1347,7 +1419,7 @@
/* */
/***********************************************************************/
void
*
other
;
FT_Generic
extra
;
}
TT_FaceRec
;
...
...
@@ -1397,7 +1469,7 @@
typedef
struct
TT_ExecContextRec_
*
TT_ExecContext
;
/* glyph loader structure */
typedef
struct
TT_Loader_
struct
TT_Loader_
{
FT_Face
face
;
FT_Size
size
;
...
...
@@ -1427,8 +1499,11 @@
TT_ExecContext
exec
;
FT_Byte
*
instructions
;
FT_ULong
ins_pos
;
/* for possible extensibility in other formats */
void
*
other
;
}
TT_Loader
;
};
...
...
src/cff/t2gload.c
View file @
994d7747
...
...
@@ -333,7 +333,7 @@
T2_Size
size
,
T2_GlyphSlot
slot
)
{
CFF_Font
*
cff
=
(
CFF_Font
*
)
face
->
other
;
CFF_Font
*
cff
=
(
CFF_Font
*
)
face
->
extra
.
data
;
/* clear everything */
...
...
@@ -1608,7 +1608,7 @@
T2_Decoder
decoder
;
TT_Face
face
=
(
TT_Face
)
glyph
->
root
.
face
;
FT_Bool
hinting
;
CFF_Font
*
cff
=
(
CFF_Font
*
)
face
->
other
;
CFF_Font
*
cff
=
(
CFF_Font
*
)
face
->
extra
.
data
;
if
(
load_flags
&
FT_LOAD_NO_RECURSE
)
...
...
src/cff/t2objs.c
View file @
994d7747
...
...
@@ -122,7 +122,7 @@
if
(
ALLOC
(
cff
,
sizeof
(
*
cff
)
)
)
goto
Exit
;
face
->
other
=
cff
;
face
->
extra
.
data
=
cff
;
error
=
T2_Load_CFF_Font
(
stream
,
face_index
,
cff
);
if
(
error
)
goto
Exit
;
...
...
@@ -164,13 +164,13 @@
sfnt
->
done_face
(
face
);
{
CFF_Font
*
cff
=
(
CFF_Font
*
)
face
->
other
;
CFF_Font
*
cff
=
(
CFF_Font
*
)
face
->
extra
.
data
;
if
(
cff
)
{
T2_Done_CFF_Font
(
cff
);
FREE
(
face
->
other
);
FREE
(
face
->
extra
.
data
);
}
}
}
...
...
src/truetype/ttgload.c
View file @
994d7747
...
...
@@ -250,12 +250,12 @@
static
FT_Error
TT_Load_Simple_Glyph
(
TT_Loader
*
load
,
FT_Int
n_contours
)
FT_Error
TT_Load_Simple_Glyph
(
TT_Loader
*
load
)
{
FT_Error
error
;
FT_Stream
stream
=
load
->
stream
;
FT_GlyphLoader
*
gloader
=
load
->
gloader
;
FT_Stream
stream
=
load
->
stream
;
FT_GlyphLoader
*
gloader
=
load
->
gloader
;
FT_Int
n_contours
=
load
->
n_contours
;
FT_Outline
*
outline
;
TT_Face
face
=
(
TT_Face
)
load
->
face
;
TT_GlyphSlot
slot
=
(
TT_GlyphSlot
)
load
->
glyph
;
...
...
@@ -405,8 +405,7 @@
static
FT_Error
TT_Load_Composite_Glyph
(
TT_Loader
*
loader
,
FT_UInt
byte_count
)
FT_Error
TT_Load_Composite_Glyph
(
TT_Loader
*
loader
)
{
FT_Error
error
;
FT_Stream
stream
=
loader
->
stream
;
...
...
@@ -490,6 +489,16 @@
}
LOCAL_FUNC
void
TT_Init_Glyph_Loading
(
TT_Face
face
)
{
face
->
access_glyph_frame
=
TT_Access_Glyph_Frame
;
face
->
read_glyph_header
=
TT_Load_Glyph_Header
;
face
->
read_simple_glyph
=
TT_Load_Simple_Glyph
;
face
->
read_composite_glyph
=
TT_Load_Composite_Glyph
;
face
->
forget_glyph_frame
=
TT_Forget_Glyph_Frame
;
}
/*************************************************************************/
/* */
...
...
@@ -708,13 +717,13 @@
offset
=
loader
->
glyf_offset
+
offset
;
/* access glyph frame */
error
=
TT_A
ccess_
G
lyph_
F
rame
(
loader
,
glyph_index
,
offset
,
count
);
error
=
face
->
a
ccess_
g
lyph_
f
rame
(
loader
,
glyph_index
,
offset
,
count
);
if
(
error
)
goto
Exit
;
opened_frame
=
1
;
/* read first glyph header */
error
=
TT_Lo
ad_
G
lyph_
H
eader
(
loader
);
error
=
face
->
re
ad_
g
lyph_
h
eader
(
loader
);
if
(
error
)
goto
Fail
;
contours_count
=
loader
->
n_contours
;
...
...
@@ -744,7 +753,7 @@
error
=
FT_GlyphLoader_Check_Points
(
gloader
,
0
,
contours_count
);
if
(
error
)
goto
Fail
;
error
=
TT_Lo
ad_
S
imple_
G
lyph
(
loader
,
contours_count
);
error
=
face
->
re
ad_
s
imple_
g
lyph
(
loader
);
if
(
error
)
goto
Fail
;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
...
...
@@ -779,10 +788,10 @@
start_contour
=
gloader
->
base
.
outline
.
n_contours
;
error
=
TT_Lo
ad_
C
omposite_
G
lyph
(
loader
,
count
);
error
=
face
->
re
ad_
c
omposite_
g
lyph
(
loader
);
if
(
error
)
goto
Fail
;
TT_F
orget_
G
lyph_
F
rame
(
loader
);
face
->
f
orget_
g
lyph_
f
rame
(
loader
);
opened_frame
=
0
;
/* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
...
...
@@ -1031,7 +1040,7 @@
Fail:
if
(
opened_frame
)
TT_F
orget_
G
lyph_
F
rame
(
loader
);
face
->
f
orget_
g
lyph_
f
rame
(
loader
);
Exit:
return
error
;
...
...
src/truetype/ttgload.h
View file @
994d7747
...
...
@@ -36,6 +36,10 @@
FT_Short
*
bearing
,
FT_UShort
*
advance
);
LOCAL_DEF
void
TT_Init_Glyph_Loading
(
TT_Face
face
);
LOCAL_DEF
FT_Error
TT_Load_Glyph
(
TT_Size
size
,
TT_GlyphSlot
glyph
,
...
...
src/truetype/ttobjs.c
View file @
994d7747
...
...
@@ -27,6 +27,7 @@
#include
<ttobjs.h>
#include
<ttpload.h>
#include
<ttgload.h>
#include
<freetype/internal/tterrors.h>
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
...
...
@@ -189,6 +190,9 @@
TT_Load_CVT
(
face
,
stream
)
||
TT_Load_Programs
(
face
,
stream
);
/* initialise standard glyph loading routines */
TT_Init_Glyph_Loading
(
face
);
Exit:
return
error
;
...
...
@@ -217,6 +221,9 @@
SFNT_Interface
*
sfnt
=
face
->
sfnt
;
/* for "extended TrueType formats" (i.e. compressed versions) */
if
(
face
->
extra
.
finalizer
)
face
->
extra
.
finalizer
(
face
->
extra
.
data
);
if
(
sfnt
)
sfnt
->
done_face
(
face
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment