ReactOS 0.4.16-dev-2354-g16de117
psobjs.h File Reference
Include dependency graph for psobjs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 ps_table_new (PS_Table table, FT_Int count, FT_Memory memory)
 
 ps_table_add (PS_Table table, FT_Int idx, const void *object, FT_UInt length)
 
 ps_table_done (PS_Table table)
 
 ps_table_release (PS_Table table)
 
 ps_parser_skip_spaces (PS_Parser parser)
 
 ps_parser_skip_PS_token (PS_Parser parser)
 
 ps_parser_to_token (PS_Parser parser, T1_Token token)
 
 ps_parser_to_token_array (PS_Parser parser, T1_Token tokens, FT_UInt max_tokens, FT_Int *pnum_tokens)
 
 ps_parser_load_field (PS_Parser parser, const T1_Field field, void **objects, FT_UInt max_objects, FT_ULong *pflags)
 
 ps_parser_load_field_table (PS_Parser parser, const T1_Field field, void **objects, FT_UInt max_objects, FT_ULong *pflags)
 
 ps_parser_to_int (PS_Parser parser)
 
 ps_parser_to_bytes (PS_Parser parser, FT_Byte *bytes, FT_Offset max_bytes, FT_ULong *pnum_bytes, FT_Bool delimiters)
 
 ps_parser_to_fixed (PS_Parser parser, FT_Int power_ten)
 
 ps_parser_to_coord_array (PS_Parser parser, FT_Int max_coords, FT_Short *coords)
 
 ps_parser_to_fixed_array (PS_Parser parser, FT_Int max_values, FT_Fixed *values, FT_Int power_ten)
 
 ps_parser_init (PS_Parser parser, FT_Byte *base, FT_Byte *limit, FT_Memory memory)
 
 ps_parser_done (PS_Parser parser)
 
 t1_builder_init (T1_Builder builder, FT_Face face, FT_Size size, FT_GlyphSlot glyph, FT_Bool hinting)
 
 t1_builder_done (T1_Builder builder)
 
 t1_builder_check_points (T1_Builder builder, FT_Int count)
 
 t1_builder_add_point (T1_Builder builder, FT_Pos x, FT_Pos y, FT_Byte flag)
 
 t1_builder_add_point1 (T1_Builder builder, FT_Pos x, FT_Pos y)
 
 t1_builder_add_contour (T1_Builder builder)
 
 t1_builder_start_point (T1_Builder builder, FT_Pos x, FT_Pos y)
 
 t1_builder_close_contour (T1_Builder builder)
 
 cff_builder_init (CFF_Builder *builder, TT_Face face, CFF_Size size, CFF_GlyphSlot glyph, FT_Bool hinting)
 
 cff_builder_done (CFF_Builder *builder)
 
 cff_check_points (CFF_Builder *builder, FT_Int count)
 
 cff_builder_add_point (CFF_Builder *builder, FT_Pos x, FT_Pos y, FT_Byte flag)
 
 cff_builder_add_point1 (CFF_Builder *builder, FT_Pos x, FT_Pos y)
 
 cff_builder_start_point (CFF_Builder *builder, FT_Pos x, FT_Pos y)
 
 cff_builder_close_contour (CFF_Builder *builder)
 
 cff_builder_add_contour (CFF_Builder *builder)
 
 ps_builder_init (PS_Builder *ps_builder, void *builder, FT_Bool is_t1)
 
 ps_builder_done (PS_Builder *builder)
 
 ps_builder_check_points (PS_Builder *builder, FT_Int count)
 
 ps_builder_add_point (PS_Builder *builder, FT_Pos x, FT_Pos y, FT_Byte flag)
 
 ps_builder_add_point1 (PS_Builder *builder, FT_Pos x, FT_Pos y)
 
 ps_builder_add_contour (PS_Builder *builder)
 
 ps_builder_start_point (PS_Builder *builder, FT_Pos x, FT_Pos y)
 
 ps_builder_close_contour (PS_Builder *builder)
 
 ps_decoder_init (PS_Decoder *ps_decoder, void *decoder, FT_Bool is_t1)
 
 t1_make_subfont (FT_Face face, PS_Private priv, CFF_SubFont subfont)
 
 t1_decrypt (FT_Byte *buffer, FT_Offset length, FT_UShort seed)
 
 cff_random (FT_UInt32 r)
 

Variables

FT_BEGIN_HEADER FT_CALLBACK_TABLE const PS_Table_FuncsRec ps_table_funcs
 
FT_CALLBACK_TABLE const PS_Parser_FuncsRec ps_parser_funcs
 
FT_CALLBACK_TABLE const T1_Builder_FuncsRec t1_builder_funcs
 

Function Documentation

◆ cff_builder_add_contour()

cff_builder_add_contour ( CFF_Builder builder)

Definition at line 1982 of file psobjs.c.

1983 {
1984 FT_Outline* outline = builder->current;
1986
1987
1988 if ( !builder->load_points )
1989 {
1990 outline->n_contours++;
1991 return FT_Err_Ok;
1992 }
1993
1994 error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
1995 if ( !error )
1996 {
1997 if ( outline->n_contours > 0 )
1998 outline->contours[outline->n_contours - 1] =
1999 (short)( outline->n_points - 1 );
2000
2001 outline->n_contours++;
2002 }
2003
2004 return error;
2005 }
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
Definition: ftgloadr.h:117
int FT_Error
Definition: fttypes.h:299
#define error(str)
Definition: mkdosfs.c:1605
FT_GlyphLoader loader
Definition: psaux.h:1112
FT_Bool load_points
Definition: psaux.h:1125
FT_Outline * current
Definition: psaux.h:1114
Definition: mesh.c:5330

Referenced by cff_builder_start_point().

◆ cff_builder_add_point()

cff_builder_add_point ( CFF_Builder builder,
FT_Pos  x,
FT_Pos  y,
FT_Byte  flag 
)

Definition at line 1927 of file psobjs.c.

1931 {
1932 FT_Outline* outline = builder->current;
1933
1934
1935 if ( builder->load_points )
1936 {
1937 FT_Vector* point = outline->points + outline->n_points;
1938 FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
1939
1940#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1942
1943
1944 if ( driver->hinting_engine == FT_HINTING_FREETYPE )
1945 {
1946 point->x = x >> 16;
1947 point->y = y >> 16;
1948 }
1949 else
1950#endif
1951 {
1952 /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
1953 point->x = x >> 10;
1954 point->y = y >> 10;
1955 }
1957 }
1958
1959 outline->n_points++;
1960 }
POINTL point
Definition: edittest.c:50
#define FT_HINTING_FREETYPE
Definition: ftdriver.h:343
#define FT_CURVE_TAG_CUBIC
Definition: ftimage.h:464
#define FT_CURVE_TAG_ON
Definition: ftimage.h:462
#define FT_FACE_DRIVER(x)
Definition: ftobjs.h:601
unsigned char FT_Byte
Definition: fttypes.h:154
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
struct @1789::@1790 driver
FT_BEGIN_HEADER struct PS_DriverRec_ * PS_Driver
TT_Face face
Definition: psaux.h:1110
LONG y
Definition: windef.h:130
LONG x
Definition: windef.h:129
Definition: dialog.c:52

Referenced by cff_builder_add_point1().

◆ cff_builder_add_point1()

cff_builder_add_point1 ( CFF_Builder builder,
FT_Pos  x,
FT_Pos  y 
)

Definition at line 1965 of file psobjs.c.

1968 {
1970
1971
1972 error = cff_check_points( builder, 1 );
1973 if ( !error )
1974 cff_builder_add_point( builder, x, y, 1 );
1975
1976 return error;
1977 }
cff_builder_add_point(CFF_Builder *builder, FT_Pos x, FT_Pos y, FT_Byte flag)
Definition: psobjs.c:1927
cff_check_points(CFF_Builder *builder, FT_Int count)
Definition: psobjs.c:1918

Referenced by cff_builder_start_point().

◆ cff_builder_close_contour()

cff_builder_close_contour ( CFF_Builder builder)

Definition at line 2032 of file psobjs.c.

2033 {
2034 FT_Outline* outline = builder->current;
2035 FT_Int first;
2036
2037
2038 if ( !outline )
2039 return;
2040
2041 first = outline->n_contours <= 1
2042 ? 0 : outline->contours[outline->n_contours - 2] + 1;
2043
2044 /* in malformed fonts it can happen that a contour was started */
2045 /* but no points were added */
2046 if ( outline->n_contours && first == outline->n_points )
2047 {
2048 outline->n_contours--;
2049 return;
2050 }
2051
2052 /* We must not include the last point in the path if it */
2053 /* is located on the first point. */
2054 if ( outline->n_points > 1 )
2055 {
2056 FT_Vector* p1 = outline->points + first;
2057 FT_Vector* p2 = outline->points + outline->n_points - 1;
2058 FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
2059
2060
2061 /* `delete' last point only if it coincides with the first */
2062 /* point and if it is not a control point (which can happen). */
2063 if ( p1->x == p2->x && p1->y == p2->y )
2064 if ( *control == FT_CURVE_TAG_ON )
2065 outline->n_points--;
2066 }
2067
2068 if ( outline->n_contours > 0 )
2069 {
2070 /* Don't add contours only consisting of one point, i.e., */
2071 /* check whether begin point and last point are the same. */
2072 if ( first == outline->n_points - 1 )
2073 {
2074 outline->n_contours--;
2075 outline->n_points--;
2076 }
2077 else
2078 outline->contours[outline->n_contours - 1] =
2079 (short)( outline->n_points - 1 );
2080 }
2081 }
signed int FT_Int
Definition: fttypes.h:220
const GLint * first
Definition: glext.h:5794
if(dx< 0)
Definition: linetemp.h:194
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78

◆ cff_builder_done()

cff_builder_done ( CFF_Builder builder)

Definition at line 1906 of file psobjs.c.

1907 {
1908 CFF_GlyphSlot glyph = builder->glyph;
1909
1910
1911 if ( glyph )
1912 glyph->root.outline = *builder->base;
1913 }
CFF_GlyphSlot glyph
Definition: psaux.h:1111
FT_Outline * base
Definition: psaux.h:1113
FT_GlyphSlotRec root
Definition: cffotypes.h:61
FT_Outline outline
Definition: freetype.h:1890

◆ cff_builder_init()

cff_builder_init ( CFF_Builder builder,
TT_Face  face,
CFF_Size  size,
CFF_GlyphSlot  glyph,
FT_Bool  hinting 
)

Definition at line 1840 of file psobjs.c.

1845 {
1846 builder->path_begun = 0;
1847 builder->load_points = 1;
1848
1849 builder->face = face;
1850 builder->glyph = glyph;
1851 builder->memory = face->root.memory;
1852
1853 if ( glyph )
1854 {
1855 FT_GlyphLoader loader = glyph->root.internal->loader;
1856
1857
1858 builder->loader = loader;
1859 builder->base = &loader->base.outline;
1860 builder->current = &loader->current.outline;
1861 FT_GlyphLoader_Rewind( loader );
1862
1863 builder->hints_globals = NULL;
1864 builder->hints_funcs = NULL;
1865
1866 if ( hinting && size )
1867 {
1868 FT_Size ftsize = FT_SIZE( size );
1870
1871 if ( internal )
1872 {
1873 builder->hints_globals = (void *)internal->topfont;
1874 builder->hints_funcs = glyph->root.internal->glyph_hints;
1875 }
1876 }
1877 }
1878
1879 builder->pos_x = 0;
1880 builder->pos_y = 0;
1881
1882 builder->left_bearing.x = 0;
1883 builder->left_bearing.y = 0;
1884 builder->advance.x = 0;
1885 builder->advance.y = 0;
1886
1887 builder->funcs = cff_builder_funcs;
1888 }
ios_base &_STLP_CALL internal(ios_base &__s)
Definition: _ios_base.h:311
struct CFF_InternalRec_ * CFF_Internal
#define NULL
Definition: types.h:112
WORD face[3]
Definition: mesh.c:4747
FT_GlyphLoader_Rewind(FT_GlyphLoader loader)
Definition: ftgloadr.c:87
#define FT_SIZE(x)
Definition: ftobjs.h:598
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
FT_CALLBACK_TABLE_DEF const CFF_Builder_FuncsRec cff_builder_funcs
Definition: psauxmod.c:122
FT_Pos pos_x
Definition: psaux.h:1116
FT_Vector left_bearing
Definition: psaux.h:1119
FT_Memory memory
Definition: psaux.h:1109
FT_Pos pos_y
Definition: psaux.h:1117
void * hints_globals
Definition: psaux.h:1131
void * hints_funcs
Definition: psaux.h:1130
FT_Vector advance
Definition: psaux.h:1120
CFF_Builder_FuncsRec funcs
Definition: psaux.h:1133
FT_Bool path_begun
Definition: psaux.h:1124
FT_Outline outline
Definition: ftgloadr.h:51
FT_GlyphLoadRec current
Definition: ftgloadr.h:69
FT_GlyphLoadRec base
Definition: ftgloadr.h:68
FT_Slot_Internal internal
Definition: freetype.h:1903
FT_Size_Internal internal
Definition: freetype.h:1637
void * module_data
Definition: ftobjs.h:459
void * glyph_hints
Definition: ftobjs.h:430
FT_GlyphLoader loader
Definition: ftobjs.h:425

Referenced by cff_decoder_init().

◆ cff_builder_start_point()

cff_builder_start_point ( CFF_Builder builder,
FT_Pos  x,
FT_Pos  y 
)

Definition at line 2010 of file psobjs.c.

2013 {
2015
2016
2017 /* test whether we are building a new contour */
2018 if ( !builder->path_begun )
2019 {
2020 builder->path_begun = 1;
2021 error = cff_builder_add_contour( builder );
2022 if ( !error )
2023 error = cff_builder_add_point1( builder, x, y );
2024 }
2025
2026 return error;
2027 }
cff_builder_add_point1(CFF_Builder *builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:1965
cff_builder_add_contour(CFF_Builder *builder)
Definition: psobjs.c:1982

◆ cff_check_points()

cff_check_points ( CFF_Builder builder,
FT_Int  count 
)

Definition at line 1918 of file psobjs.c.

1920 {
1921 return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
1922 }
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by cff_builder_add_point1().

◆ cff_random()

cff_random ( FT_UInt32  r)

Definition at line 2587 of file psobjs.c.

2588 {
2589 /* a 32bit version of the `xorshift' algorithm */
2590 r ^= r << 13;
2591 r ^= r >> 17;
2592 r ^= r << 5;
2593
2594 return r;
2595 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055

Referenced by cf2_interpT2CharString(), and t1_make_subfont().

◆ ps_builder_add_contour()

ps_builder_add_contour ( PS_Builder builder)

Definition at line 2283 of file psobjs.c.

2284 {
2285 FT_Outline* outline = builder->current;
2287
2288
2289 /* this might happen in invalid fonts */
2290 if ( !outline )
2291 {
2292 FT_ERROR(( "ps_builder_add_contour: no outline to add points to\n" ));
2293 return FT_THROW( Invalid_File_Format );
2294 }
2295
2296 if ( !builder->load_points )
2297 {
2298 outline->n_contours++;
2299 return FT_Err_Ok;
2300 }
2301
2302 error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
2303 if ( !error )
2304 {
2305 if ( outline->n_contours > 0 )
2306 outline->contours[outline->n_contours - 1] =
2307 (short)( outline->n_points - 1 );
2308
2309 outline->n_contours++;
2310 }
2311
2312 return error;
2313 }
#define FT_ERROR(varformat)
Definition: ftdebug.h:211
#define FT_THROW(e)
Definition: ftdebug.h:243
FT_Bool load_points
Definition: psaux.h:580
FT_GlyphLoader loader
Definition: psaux.h:568
FT_Outline * current
Definition: psaux.h:570

Referenced by ps_builder_start_point().

◆ ps_builder_add_point()

ps_builder_add_point ( PS_Builder builder,
FT_Pos  x,
FT_Pos  y,
FT_Byte  flag 
)

Definition at line 2216 of file psobjs.c.

2220 {
2221 FT_Outline* outline = builder->current;
2222
2223
2224 if ( builder->load_points )
2225 {
2226 FT_Vector* point = outline->points + outline->n_points;
2227 FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
2228
2229#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
2231
2232
2233 if ( !builder->is_t1 &&
2234 driver->hinting_engine == FT_HINTING_FREETYPE )
2235 {
2236 point->x = x >> 16;
2237 point->y = y >> 16;
2238 }
2239 else
2240#endif
2241#ifdef T1_CONFIG_OPTION_OLD_ENGINE
2242#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
2244#endif
2245 if ( builder->is_t1 &&
2246 driver->hinting_engine == FT_HINTING_FREETYPE )
2247 {
2248 point->x = FIXED_TO_INT( x );
2249 point->y = FIXED_TO_INT( y );
2250 }
2251 else
2252#endif
2253 {
2254 /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
2255 point->x = x >> 10;
2256 point->y = y >> 10;
2257 }
2259 }
2260 outline->n_points++;
2261 }
#define FIXED_TO_INT(x)
Definition: ftcalc.h:450
FT_Bool is_t1
Definition: psaux.h:584
FT_Face face
Definition: psaux.h:566

Referenced by cf2_builder_cubeTo(), and ps_builder_add_point1().

◆ ps_builder_add_point1()

ps_builder_add_point1 ( PS_Builder builder,
FT_Pos  x,
FT_Pos  y 
)

Definition at line 2266 of file psobjs.c.

2269 {
2271
2272
2273 error = ps_builder_check_points( builder, 1 );
2274 if ( !error )
2275 ps_builder_add_point( builder, x, y, 1 );
2276
2277 return error;
2278 }
ps_builder_add_point(PS_Builder *builder, FT_Pos x, FT_Pos y, FT_Byte flag)
Definition: psobjs.c:2216
ps_builder_check_points(PS_Builder *builder, FT_Int count)
Definition: psobjs.c:2207

Referenced by cf2_builder_lineTo(), and ps_builder_start_point().

◆ ps_builder_check_points()

ps_builder_check_points ( PS_Builder builder,
FT_Int  count 
)

Definition at line 2207 of file psobjs.c.

2209 {
2210 return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
2211 }

Referenced by cf2_builder_cubeTo(), cf2_interpT2CharString(), and ps_builder_add_point1().

◆ ps_builder_close_contour()

ps_builder_close_contour ( PS_Builder builder)

Definition at line 2340 of file psobjs.c.

2341 {
2342 FT_Outline* outline = builder->current;
2343 FT_Int first;
2344
2345
2346 if ( !outline )
2347 return;
2348
2349 first = outline->n_contours <= 1
2350 ? 0 : outline->contours[outline->n_contours - 2] + 1;
2351
2352 /* in malformed fonts it can happen that a contour was started */
2353 /* but no points were added */
2354 if ( outline->n_contours && first == outline->n_points )
2355 {
2356 outline->n_contours--;
2357 return;
2358 }
2359
2360 /* We must not include the last point in the path if it */
2361 /* is located on the first point. */
2362 if ( outline->n_points > 1 )
2363 {
2364 FT_Vector* p1 = outline->points + first;
2365 FT_Vector* p2 = outline->points + outline->n_points - 1;
2366 FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
2367
2368
2369 /* `delete' last point only if it coincides with the first */
2370 /* point and it is not a control point (which can happen). */
2371 if ( p1->x == p2->x && p1->y == p2->y )
2372 if ( *control == FT_CURVE_TAG_ON )
2373 outline->n_points--;
2374 }
2375
2376 if ( outline->n_contours > 0 )
2377 {
2378 /* Don't add contours only consisting of one point, i.e., */
2379 /* check whether the first and the last point is the same. */
2380 if ( first == outline->n_points - 1 )
2381 {
2382 outline->n_contours--;
2383 outline->n_points--;
2384 }
2385 else
2386 outline->contours[outline->n_contours - 1] =
2387 (short)( outline->n_points - 1 );
2388 }
2389 }

Referenced by cf2_builder_moveTo(), and cf2_outline_close().

◆ ps_builder_done()

ps_builder_done ( PS_Builder builder)

Definition at line 2195 of file psobjs.c.

2196 {
2197 CFF_GlyphSlot glyph = builder->glyph;
2198
2199
2200 if ( glyph )
2201 glyph->root.outline = *builder->base;
2202 }
CFF_GlyphSlot glyph
Definition: psaux.h:567
FT_Outline * base
Definition: psaux.h:569

◆ ps_builder_init()

ps_builder_init ( PS_Builder ps_builder,
void builder,
FT_Bool  is_t1 
)

Definition at line 2118 of file psobjs.c.

2121 {
2122 FT_ZERO( ps_builder );
2123
2124 if ( is_t1 )
2125 {
2126 T1_Builder t1builder = (T1_Builder)builder;
2127
2128
2129 ps_builder->memory = t1builder->memory;
2130 ps_builder->face = (FT_Face)t1builder->face;
2131 ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph;
2132 ps_builder->loader = t1builder->loader;
2133 ps_builder->base = t1builder->base;
2134 ps_builder->current = t1builder->current;
2135
2136 ps_builder->pos_x = &t1builder->pos_x;
2137 ps_builder->pos_y = &t1builder->pos_y;
2138
2139 ps_builder->left_bearing = &t1builder->left_bearing;
2140 ps_builder->advance = &t1builder->advance;
2141
2142 ps_builder->bbox = &t1builder->bbox;
2143 ps_builder->path_begun = 0;
2144 ps_builder->load_points = t1builder->load_points;
2145 ps_builder->no_recurse = t1builder->no_recurse;
2146
2147 ps_builder->metrics_only = t1builder->metrics_only;
2148 }
2149 else
2150 {
2151 CFF_Builder* cffbuilder = (CFF_Builder*)builder;
2152
2153
2154 ps_builder->memory = cffbuilder->memory;
2155 ps_builder->face = (FT_Face)cffbuilder->face;
2156 ps_builder->glyph = cffbuilder->glyph;
2157 ps_builder->loader = cffbuilder->loader;
2158 ps_builder->base = cffbuilder->base;
2159 ps_builder->current = cffbuilder->current;
2160
2161 ps_builder->pos_x = &cffbuilder->pos_x;
2162 ps_builder->pos_y = &cffbuilder->pos_y;
2163
2164 ps_builder->left_bearing = &cffbuilder->left_bearing;
2165 ps_builder->advance = &cffbuilder->advance;
2166
2167 ps_builder->bbox = &cffbuilder->bbox;
2168 ps_builder->path_begun = cffbuilder->path_begun;
2169 ps_builder->load_points = cffbuilder->load_points;
2170 ps_builder->no_recurse = cffbuilder->no_recurse;
2171
2172 ps_builder->metrics_only = cffbuilder->metrics_only;
2173 }
2174
2175 ps_builder->is_t1 = is_t1;
2176 ps_builder->funcs = ps_builder_funcs;
2177 }
struct FT_FaceRec_ * FT_Face
Definition: freetype.h:483
#define FT_ZERO(p)
Definition: ftmemory.h:246
struct T1_BuilderRec_ * T1_Builder
Definition: psaux.h:698
FT_CALLBACK_TABLE_DEF const PS_Builder_FuncsRec ps_builder_funcs
Definition: psauxmod.c:64
FT_Bool metrics_only
Definition: psaux.h:1128
FT_BBox bbox
Definition: psaux.h:1122
FT_Bool no_recurse
Definition: psaux.h:1126
FT_Vector * advance
Definition: psaux.h:576
FT_Vector * left_bearing
Definition: psaux.h:575
FT_Pos * pos_y
Definition: psaux.h:573
FT_Bool no_recurse
Definition: psaux.h:581
FT_Memory memory
Definition: psaux.h:565
FT_Pos * pos_x
Definition: psaux.h:572
PS_Builder_FuncsRec funcs
Definition: psaux.h:586
FT_Bool path_begun
Definition: psaux.h:579
FT_BBox * bbox
Definition: psaux.h:578
FT_Bool metrics_only
Definition: psaux.h:583
FT_Bool no_recurse
Definition: psaux.h:845
FT_GlyphSlot glyph
Definition: psaux.h:831
FT_Vector advance
Definition: psaux.h:840
FT_BBox bbox
Definition: psaux.h:842
FT_Outline * base
Definition: psaux.h:833
FT_Face face
Definition: psaux.h:830
FT_Outline * current
Definition: psaux.h:834
FT_Vector left_bearing
Definition: psaux.h:839
FT_Bool metrics_only
Definition: psaux.h:847
FT_Memory memory
Definition: psaux.h:829
FT_Bool load_points
Definition: psaux.h:844
FT_Pos pos_y
Definition: psaux.h:837
FT_Pos pos_x
Definition: psaux.h:836
FT_GlyphLoader loader
Definition: psaux.h:832

Referenced by ps_decoder_init().

◆ ps_builder_start_point()

ps_builder_start_point ( PS_Builder builder,
FT_Pos  x,
FT_Pos  y 
)

Definition at line 2318 of file psobjs.c.

2321 {
2323
2324
2325 /* test whether we are building a new contour */
2326 if ( !builder->path_begun )
2327 {
2328 builder->path_begun = 1;
2329 error = ps_builder_add_contour( builder );
2330 if ( !error )
2331 error = ps_builder_add_point1( builder, x, y );
2332 }
2333
2334 return error;
2335 }
ps_builder_add_contour(PS_Builder *builder)
Definition: psobjs.c:2283
ps_builder_add_point1(PS_Builder *builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:2266

Referenced by cf2_builder_cubeTo(), and cf2_builder_lineTo().

◆ ps_decoder_init()

ps_decoder_init ( PS_Decoder ps_decoder,
void decoder,
FT_Bool  is_t1 
)

Definition at line 2422 of file psobjs.c.

2425 {
2426 FT_ZERO( ps_decoder );
2427
2428 if ( is_t1 )
2429 {
2430 T1_Decoder t1_decoder = (T1_Decoder)decoder;
2431
2432
2433 ps_builder_init( &ps_decoder->builder,
2434 &t1_decoder->builder,
2435 is_t1 );
2436
2437 ps_decoder->cf2_instance = &t1_decoder->cf2_instance;
2438 ps_decoder->psnames = t1_decoder->psnames;
2439
2440 ps_decoder->num_glyphs = t1_decoder->num_glyphs;
2441 ps_decoder->glyph_names = t1_decoder->glyph_names;
2442 ps_decoder->hint_mode = t1_decoder->hint_mode;
2443 ps_decoder->blend = t1_decoder->blend;
2444
2445 ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs;
2446 ps_decoder->locals = t1_decoder->subrs;
2447 ps_decoder->locals_len = t1_decoder->subrs_len;
2448 ps_decoder->locals_hash = t1_decoder->subrs_hash;
2449
2450 ps_decoder->buildchar = t1_decoder->buildchar;
2451 ps_decoder->len_buildchar = t1_decoder->len_buildchar;
2452
2453 ps_decoder->lenIV = t1_decoder->lenIV;
2454 }
2455 else
2456 {
2457 CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder;
2458
2459
2460 ps_builder_init( &ps_decoder->builder,
2461 &cff_decoder->builder,
2462 is_t1 );
2463
2464 ps_decoder->cff = cff_decoder->cff;
2465 ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance;
2466 ps_decoder->current_subfont = cff_decoder->current_subfont;
2467
2468 ps_decoder->num_globals = cff_decoder->num_globals;
2469 ps_decoder->globals = cff_decoder->globals;
2470 ps_decoder->globals_bias = cff_decoder->globals_bias;
2471 ps_decoder->num_locals = cff_decoder->num_locals;
2472 ps_decoder->locals = cff_decoder->locals;
2473 ps_decoder->locals_bias = cff_decoder->locals_bias;
2474
2475 ps_decoder->glyph_width = &cff_decoder->glyph_width;
2476 ps_decoder->width_only = cff_decoder->width_only;
2477
2478 ps_decoder->hint_mode = cff_decoder->hint_mode;
2479
2480 ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback;
2481 ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback;
2482 }
2483 }
unsigned int FT_UInt
Definition: fttypes.h:231
struct T1_DecoderRec_ * T1_Decoder
Definition: psaux.h:894
ps_builder_init(PS_Builder *ps_builder, void *builder, FT_Bool is_t1)
Definition: psobjs.c:2118
FT_Pos glyph_width
Definition: psaux.h:1181
FT_Bool width_only
Definition: psaux.h:1185
CFF_Builder builder
Definition: psaux.h:1168
CFF_Decoder_Get_Glyph_Callback get_glyph_callback
Definition: psaux.h:1207
FT_Int locals_bias
Definition: psaux.h:1192
FT_UInt num_globals
Definition: psaux.h:1190
CFF_Font cff
Definition: psaux.h:1169
FT_Render_Mode hint_mode
Definition: psaux.h:1201
FT_Byte ** locals
Definition: psaux.h:1195
FT_Int globals_bias
Definition: psaux.h:1193
FT_Byte ** globals
Definition: psaux.h:1196
CFF_Decoder_Free_Glyph_Callback free_glyph_callback
Definition: psaux.h:1208
CFF_SubFont current_subfont
Definition: psaux.h:1205
FT_UInt num_locals
Definition: psaux.h:1189
FT_Generic cf2_instance
Definition: cfftypes.h:400
FT_Generic * cf2_instance
Definition: psaux.h:646
FT_Byte ** globals
Definition: psaux.h:659
FT_Byte ** glyph_names
Definition: psaux.h:661
FT_UInt num_globals
Definition: psaux.h:653
FT_Render_Mode hint_mode
Definition: psaux.h:664
FT_Hash locals_hash
Definition: psaux.h:676
CFF_SubFont current_subfont
Definition: psaux.h:645
FT_UInt num_glyphs
Definition: psaux.h:662
FT_Long * buildchar
Definition: psaux.h:683
CFF_Font cff
Definition: psaux.h:644
FT_Byte ** locals
Definition: psaux.h:658
CFF_Decoder_Get_Glyph_Callback get_glyph_callback
Definition: psaux.h:668
FT_UInt len_buildchar
Definition: psaux.h:684
FT_Int lenIV
Definition: psaux.h:674
FT_UInt num_locals
Definition: psaux.h:652
FT_UInt * locals_len
Definition: psaux.h:675
CFF_Decoder_Free_Glyph_Callback free_glyph_callback
Definition: psaux.h:669
FT_Int globals_bias
Definition: psaux.h:656
FT_Bool width_only
Definition: psaux.h:649
PS_Builder builder
Definition: psaux.h:632
FT_Service_PsCMaps psnames
Definition: psaux.h:672
PS_Blend blend
Definition: psaux.h:681
FT_Pos * glyph_width
Definition: psaux.h:648
FT_Int locals_bias
Definition: psaux.h:655
FT_Byte ** subrs
Definition: psaux.h:956
FT_UInt * subrs_len
Definition: psaux.h:957
PS_Blend blend
Definition: psaux.h:967
FT_UInt num_glyphs
Definition: psaux.h:951
FT_Render_Mode hint_mode
Definition: psaux.h:969
FT_UInt len_buildchar
Definition: psaux.h:975
FT_Int num_subrs
Definition: psaux.h:955
T1_BuilderRec builder
Definition: psaux.h:942
FT_Long * buildchar
Definition: psaux.h:974
FT_Service_PsCMaps psnames
Definition: psaux.h:950
FT_Hash subrs_hash
Definition: psaux.h:958
FT_Byte ** glyph_names
Definition: psaux.h:952
FT_Int lenIV
Definition: psaux.h:954
FT_Generic cf2_instance
Definition: psaux.h:979

◆ ps_parser_done()

ps_parser_done ( PS_Parser  parser)

Definition at line 1534 of file psobjs.c.

1535 {
1536 FT_UNUSED( parser );
1537 }
#define FT_UNUSED(arg)
Definition: import.c:81

◆ ps_parser_init()

ps_parser_init ( PS_Parser  parser,
FT_Byte base,
FT_Byte limit,
FT_Memory  memory 
)

Definition at line 1519 of file psobjs.c.

1523 {
1525 parser->base = base;
1526 parser->limit = limit;
1527 parser->cursor = base;
1528 parser->memory = memory;
1529 parser->funcs = ps_parser_funcs;
1530 }
GLint limit
Definition: glext.h:10326
static char memory[1024 *256]
Definition: process.c:122
FT_CALLBACK_TABLE_DEF const PS_Parser_FuncsRec ps_parser_funcs
Definition: psauxmod.c:42
unsigned int error
Definition: inffile.c:97

◆ ps_parser_load_field()

ps_parser_load_field ( PS_Parser  parser,
const T1_Field  field,
void **  objects,
FT_UInt  max_objects,
FT_ULong pflags 
)

Definition at line 1032 of file psobjs.c.

1037 {
1039 FT_Byte* cur;
1040 FT_Byte* limit;
1041 FT_UInt count;
1042 FT_UInt idx;
1045
1046
1047 /* this also skips leading whitespace */
1049 if ( !token.type )
1050 goto Fail;
1051
1052 count = 1;
1053 idx = 0;
1054 cur = token.start;
1055 limit = token.limit;
1056
1057 type = field->type;
1058
1059 /* we must detect arrays in /FontBBox */
1060 if ( type == T1_FIELD_TYPE_BBOX )
1061 {
1062 T1_TokenRec token2;
1063 FT_Byte* old_cur = parser->cursor;
1064 FT_Byte* old_limit = parser->limit;
1065
1066
1067 /* don't include delimiters */
1068 parser->cursor = token.start + 1;
1069 parser->limit = token.limit - 1;
1070
1071 ps_parser_to_token( parser, &token2 );
1072 parser->cursor = old_cur;
1073 parser->limit = old_limit;
1074
1075 if ( token2.type == T1_TOKEN_TYPE_ARRAY )
1076 {
1078 goto FieldArray;
1079 }
1080 }
1081 else if ( token.type == T1_TOKEN_TYPE_ARRAY )
1082 {
1083 count = max_objects;
1084
1085 FieldArray:
1086 /* if this is an array and we have no blend, an error occurs */
1087 if ( max_objects == 0 )
1088 goto Fail;
1089
1090 idx = 1;
1091
1092 /* don't include delimiters */
1093 cur++;
1094 limit--;
1095 }
1096
1097 for ( ; count > 0; count--, idx++ )
1098 {
1099 FT_Byte* q = (FT_Byte*)objects[idx] + field->offset;
1100 FT_Long val;
1101 FT_String* string = NULL;
1102
1103
1104 skip_spaces( &cur, limit );
1105
1106 switch ( type )
1107 {
1108 case T1_FIELD_TYPE_BOOL:
1109 val = ps_tobool( &cur, limit );
1110 FT_TRACE4(( " %s", val ? "true" : "false" ));
1111 goto Store_Integer;
1112
1114 val = PS_Conv_ToFixed( &cur, limit, 0 );
1115 FT_TRACE4(( " %f", (double)val / 65536 ));
1116 goto Store_Integer;
1117
1119 val = PS_Conv_ToFixed( &cur, limit, 3 );
1120 FT_TRACE4(( " %f", (double)val / 65536 / 1000 ));
1121 goto Store_Integer;
1122
1124 val = PS_Conv_ToInt( &cur, limit );
1125 FT_TRACE4(( " %ld", val ));
1126 /* fall through */
1127
1128 Store_Integer:
1129 switch ( field->size )
1130 {
1131 case (8 / FT_CHAR_BIT):
1132 *(FT_Byte*)q = (FT_Byte)val;
1133 break;
1134
1135 case (16 / FT_CHAR_BIT):
1136 *(FT_UShort*)q = (FT_UShort)val;
1137 break;
1138
1139 case (32 / FT_CHAR_BIT):
1140 *(FT_UInt32*)q = (FT_UInt32)val;
1141 break;
1142
1143 default: /* for 64-bit systems */
1144 *(FT_Long*)q = val;
1145 }
1146 break;
1147
1149 case T1_FIELD_TYPE_KEY:
1150 {
1151 FT_Memory memory = parser->memory;
1152 FT_UInt len = (FT_UInt)( limit - cur );
1153
1154
1155 if ( cur >= limit )
1156 break;
1157
1158 /* we allow both a string or a name */
1159 /* for cases like /FontName (foo) def */
1160 if ( token.type == T1_TOKEN_TYPE_KEY )
1161 {
1162 /* don't include leading `/' */
1163 len--;
1164 cur++;
1165 }
1166 else if ( token.type == T1_TOKEN_TYPE_STRING )
1167 {
1168 /* don't include delimiting parentheses */
1169 /* XXX we don't handle <<...>> here */
1170 /* XXX should we convert octal escapes? */
1171 /* if so, what encoding should we use? */
1172 cur++;
1173 len -= 2;
1174 }
1175 else
1176 {
1177 FT_ERROR(( "ps_parser_load_field:"
1178 " expected a name or string\n"
1179 " "
1180 " but found token of type %d instead\n",
1181 token.type ));
1182 error = FT_THROW( Invalid_File_Format );
1183 goto Exit;
1184 }
1185
1186 /* for this to work (FT_String**)q must have been */
1187 /* initialized to NULL */
1188 if ( *(FT_String**)q )
1189 {
1190 FT_TRACE0(( "ps_parser_load_field: overwriting field %s\n",
1191 field->ident ));
1192 FT_FREE( *(FT_String**)q );
1193 *(FT_String**)q = NULL;
1194 }
1195
1196 if ( FT_ALLOC( string, len + 1 ) )
1197 goto Exit;
1198
1199 FT_MEM_COPY( string, cur, len );
1200 string[len] = 0;
1201
1202#ifdef FT_DEBUG_LEVEL_TRACE
1203 if ( token.type == T1_TOKEN_TYPE_STRING )
1204 FT_TRACE4(( " (%s)", string ));
1205 else
1206 FT_TRACE4(( " /%s", string ));
1207#endif
1208
1209 *(FT_String**)q = string;
1210 }
1211 break;
1212
1213 case T1_FIELD_TYPE_BBOX:
1214 {
1215 FT_Fixed temp[4];
1216 FT_BBox* bbox = (FT_BBox*)q;
1217 FT_Int result;
1218
1219
1220 result = ps_tofixedarray( &cur, limit, 4, temp, 0 );
1221
1222 if ( result < 4 )
1223 {
1224 FT_ERROR(( "ps_parser_load_field:"
1225 " expected four integers in bounding box\n" ));
1226 error = FT_THROW( Invalid_File_Format );
1227 goto Exit;
1228 }
1229
1230 bbox->xMin = FT_RoundFix( temp[0] );
1231 bbox->yMin = FT_RoundFix( temp[1] );
1232 bbox->xMax = FT_RoundFix( temp[2] );
1233 bbox->yMax = FT_RoundFix( temp[3] );
1234
1235 FT_TRACE4(( " [%ld %ld %ld %ld]",
1236 bbox->xMin / 65536,
1237 bbox->yMin / 65536,
1238 bbox->xMax / 65536,
1239 bbox->yMax / 65536 ));
1240 }
1241 break;
1242
1244 {
1245 FT_Memory memory = parser->memory;
1246 FT_Fixed* temp = NULL;
1247 FT_Int result;
1248 FT_UInt i;
1249
1250
1251 if ( FT_NEW_ARRAY( temp, max_objects * 4 ) )
1252 goto Exit;
1253
1254 for ( i = 0; i < 4; i++ )
1255 {
1256 result = ps_tofixedarray( &cur, limit, (FT_Int)max_objects,
1257 temp + i * max_objects, 0 );
1258 if ( result < 0 || (FT_UInt)result < max_objects )
1259 {
1260 FT_ERROR(( "ps_parser_load_field:"
1261 " expected %d integer%s in the %s subarray\n"
1262 " "
1263 " of /FontBBox in the /Blend dictionary\n",
1264 max_objects, max_objects > 1 ? "s" : "",
1265 i == 0 ? "first"
1266 : ( i == 1 ? "second"
1267 : ( i == 2 ? "third"
1268 : "fourth" ) ) ));
1269 error = FT_THROW( Invalid_File_Format );
1270
1271 FT_FREE( temp );
1272 goto Exit;
1273 }
1274
1275 skip_spaces( &cur, limit );
1276 }
1277
1278 FT_TRACE4(( " [" ));
1279 for ( i = 0; i < max_objects; i++ )
1280 {
1282
1283
1284 bbox->xMin = FT_RoundFix( temp[i ] );
1285 bbox->yMin = FT_RoundFix( temp[i + max_objects] );
1286 bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] );
1287 bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] );
1288
1289 FT_TRACE4(( " [%ld %ld %ld %ld]",
1290 bbox->xMin / 65536,
1291 bbox->yMin / 65536,
1292 bbox->xMax / 65536,
1293 bbox->yMax / 65536 ));
1294 }
1295 FT_TRACE4(( "]" ));
1296
1297 FT_FREE( temp );
1298 }
1299 break;
1300
1301 default:
1302 /* an error occurred */
1303 goto Fail;
1304 }
1305 }
1306
1307#if 0 /* obsolete -- keep for reference */
1308 if ( pflags )
1309 *pflags |= 1L << field->flag_bit;
1310#else
1311 FT_UNUSED( pflags );
1312#endif
1313
1314 error = FT_Err_Ok;
1315
1316 Exit:
1317 return error;
1318
1319 Fail:
1320 error = FT_THROW( Invalid_File_Format );
1321 goto Exit;
1322 }
unsigned int idx
Definition: utils.c:41
int Fail
Definition: ehthrow.cxx:24
FT_RoundFix(FT_Fixed a)
Definition: ftcalc.c:87
FT_BBox bbox
Definition: ftbbox.c:467
#define FT_TRACE0(varformat)
Definition: ftdebug.h:187
#define FT_TRACE4(varformat)
Definition: ftdebug.h:191
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:341
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:311
#define FT_FREE(ptr)
Definition: ftmemory.h:337
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:237
#define FT_CHAR_BIT
Definition: ftstdlib.h:61
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
signed long FT_Fixed
Definition: fttypes.h:287
signed long FT_Long
Definition: fttypes.h:242
unsigned short FT_UShort
Definition: fttypes.h:209
char FT_String
Definition: fttypes.h:187
FxCollectionEntry * cur
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLuint GLfloat * val
Definition: glext.h:7180
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
static const CLSID * objects[]
Definition: apphelp.c:112
@ T1_TOKEN_TYPE_STRING
Definition: psaux.h:188
@ T1_TOKEN_TYPE_ARRAY
Definition: psaux.h:189
@ T1_TOKEN_TYPE_KEY
Definition: psaux.h:190
enum T1_FieldType_ T1_FieldType
@ T1_FIELD_TYPE_KEY
Definition: psaux.h:217
@ T1_FIELD_TYPE_BBOX
Definition: psaux.h:218
@ T1_FIELD_TYPE_FIXED_1000
Definition: psaux.h:215
@ T1_FIELD_TYPE_STRING
Definition: psaux.h:216
@ T1_FIELD_TYPE_FIXED
Definition: psaux.h:214
@ T1_FIELD_TYPE_INTEGER
Definition: psaux.h:213
@ T1_FIELD_TYPE_MM_BBOX
Definition: psaux.h:219
@ T1_FIELD_TYPE_BOOL
Definition: psaux.h:212
PS_Conv_ToInt(FT_Byte **cursor, FT_Byte *limit)
Definition: psconv.c:161
PS_Conv_ToFixed(FT_Byte **cursor, FT_Byte *limit, FT_Long power_ten)
Definition: psconv.c:195
ps_parser_to_token(PS_Parser parser, T1_Token token)
Definition: psobjs.c:625
static FT_Int ps_tofixedarray(FT_Byte **acur, FT_Byte *limit, FT_Int max_values, FT_Fixed *values, FT_Int power_ten)
Definition: psobjs.c:860
static int ps_tobool(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:996
static void skip_spaces(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:312
static calc_node_t temp
Definition: rpn_ieee.c:38
static void Exit(void)
Definition: sock.c:1330
FT_Pos xMin
Definition: ftimage.h:120
FT_Pos yMax
Definition: ftimage.h:121
FT_Pos yMin
Definition: ftimage.h:120
FT_Pos xMax
Definition: ftimage.h:121
T1_TokenType type
Definition: psaux.h:203
Definition: parser.c:44

Referenced by ps_parser_load_field_table().

◆ ps_parser_load_field_table()

ps_parser_load_field_table ( PS_Parser  parser,
const T1_Field  field,
void **  objects,
FT_UInt  max_objects,
FT_ULong pflags 
)

Definition at line 1329 of file psobjs.c.

1334 {
1337 FT_Int num_elements;
1339 FT_Byte* old_cursor;
1340 FT_Byte* old_limit;
1341 T1_FieldRec fieldrec = *(T1_Field)field;
1342
1343
1344 fieldrec.type = T1_FIELD_TYPE_INTEGER;
1347 fieldrec.type = T1_FIELD_TYPE_FIXED;
1348
1350 T1_MAX_TABLE_ELEMENTS, &num_elements );
1351 if ( num_elements < 0 )
1352 {
1353 error = FT_ERR( Ignore );
1354 goto Exit;
1355 }
1356 if ( (FT_UInt)num_elements > field->array_max )
1357 num_elements = (FT_Int)field->array_max;
1358
1359 old_cursor = parser->cursor;
1360 old_limit = parser->limit;
1361
1362 /* we store the elements count if necessary; */
1363 /* we further assume that `count_offset' can't be zero */
1364 if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
1365 *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
1366 (FT_Byte)num_elements;
1367
1368 FT_TRACE4(( " [" ));
1369
1370 /* we now load each element, adjusting the field.offset on each one */
1371 token = elements;
1372 for ( ; num_elements > 0; num_elements--, token++ )
1373 {
1374 parser->cursor = token->start;
1375 parser->limit = token->limit;
1376
1378 &fieldrec,
1379 objects,
1380 max_objects,
1381 0 );
1382 if ( error )
1383 break;
1384
1385 fieldrec.offset += fieldrec.size;
1386 }
1387
1388 FT_TRACE4(( "]" ));
1389
1390#if 0 /* obsolete -- keep for reference */
1391 if ( pflags )
1392 *pflags |= 1L << field->flag_bit;
1393#else
1394 FT_UNUSED( pflags );
1395#endif
1396
1397 parser->cursor = old_cursor;
1398 parser->limit = old_limit;
1399
1400 Exit:
1401 return error;
1402 }
#define FT_ERR(e)
Definition: fttypes.h:599
@ T1_FIELD_TYPE_FIXED_ARRAY
Definition: psaux.h:221
struct T1_FieldRec_ * T1_Field
Definition: psaux.h:180
ps_parser_to_token_array(PS_Parser parser, T1_Token tokens, FT_UInt max_tokens, FT_Int *pnum_tokens)
Definition: psobjs.c:728
#define T1_MAX_TABLE_ELEMENTS
Definition: psobjs.c:1325
ps_parser_load_field(PS_Parser parser, const T1_Field field, void **objects, FT_UInt max_objects, FT_ULong *pflags)
Definition: psobjs.c:1032
FT_UInt offset
Definition: psaux.h:260
FT_Byte size
Definition: psaux.h:261
T1_FieldType type
Definition: psaux.h:258

◆ ps_parser_skip_PS_token()

ps_parser_skip_PS_token ( PS_Parser  parser)

Definition at line 517 of file psobjs.c.

518 {
519 /* Note: PostScript allows any non-delimiting, non-whitespace */
520 /* character in a name (PS Ref Manual, 3rd ed, p31). */
521 /* PostScript delimiters are (, ), <, >, [, ], {, }, /, and %. */
522
523 FT_Byte* cur = parser->cursor;
524 FT_Byte* limit = parser->limit;
526
527
528 skip_spaces( &cur, limit ); /* this also skips comments */
529 if ( cur >= limit )
530 goto Exit;
531
532 /* self-delimiting, single-character tokens */
533 if ( *cur == '[' || *cur == ']' )
534 {
535 cur++;
536 goto Exit;
537 }
538
539 /* skip balanced expressions (procedures and strings) */
540
541 if ( *cur == '{' ) /* {...} */
542 {
544 goto Exit;
545 }
546
547 if ( *cur == '(' ) /* (...) */
548 {
550 goto Exit;
551 }
552
553 if ( *cur == '<' ) /* <...> */
554 {
555 if ( cur + 1 < limit && *(cur + 1) == '<' ) /* << */
556 {
557 cur++;
558 cur++;
559 }
560 else
561 error = skip_string( &cur, limit );
562
563 goto Exit;
564 }
565
566 if ( *cur == '>' )
567 {
568 cur++;
569 if ( cur >= limit || *cur != '>' ) /* >> */
570 {
571 FT_ERROR(( "ps_parser_skip_PS_token:"
572 " unexpected closing delimiter `>'\n" ));
573 error = FT_THROW( Invalid_File_Format );
574 goto Exit;
575 }
576 cur++;
577 goto Exit;
578 }
579
580 if ( *cur == '/' )
581 cur++;
582
583 /* anything else */
584 while ( cur < limit )
585 {
586 /* *cur might be invalid (e.g., ')' or '}'), but this */
587 /* is handled by the test `cur == parser->cursor' below */
588 if ( IS_PS_DELIM( *cur ) )
589 break;
590
591 cur++;
592 }
593
594 Exit:
595 if ( cur < limit && cur == parser->cursor )
596 {
597 FT_ERROR(( "ps_parser_skip_PS_token:"
598 " current token is `%c' which is self-delimiting\n"
599 " "
600 " but invalid at this point\n",
601 *cur ));
602
603 error = FT_THROW( Invalid_File_Format );
604 }
605
606 if ( cur > limit )
607 cur = limit;
608
609 parser->error = error;
610 parser->cursor = cur;
611 }
const char cursor[]
Definition: icontest.c:13
#define IS_PS_DELIM(ch)
Definition: psaux.h:1410
static FT_Error skip_string(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:418
static FT_Error skip_literal_string(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:342
static FT_Error skip_procedure(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:457

Referenced by ps_parser_to_token().

◆ ps_parser_skip_spaces()

ps_parser_skip_spaces ( PS_Parser  parser)

◆ ps_parser_to_bytes()

ps_parser_to_bytes ( PS_Parser  parser,
FT_Byte bytes,
FT_Offset  max_bytes,
FT_ULong pnum_bytes,
FT_Bool  delimiters 
)

Definition at line 1416 of file psobjs.c.

1421 {
1423 FT_Byte* cur;
1424
1425
1427 cur = parser->cursor;
1428
1429 if ( cur >= parser->limit )
1430 goto Exit;
1431
1432 if ( delimiters )
1433 {
1434 if ( *cur != '<' )
1435 {
1436 FT_ERROR(( "ps_parser_to_bytes: Missing starting delimiter `<'\n" ));
1437 error = FT_THROW( Invalid_File_Format );
1438 goto Exit;
1439 }
1440
1441 cur++;
1442 }
1443
1444 *pnum_bytes = PS_Conv_ASCIIHexDecode( &cur,
1445 parser->limit,
1446 bytes,
1447 max_bytes );
1448
1449 parser->cursor = cur;
1450
1451 if ( delimiters )
1452 {
1453 if ( cur < parser->limit && *cur != '>' )
1454 {
1455 FT_ERROR(( "ps_parser_to_bytes: Missing closing delimiter `>'\n" ));
1456 error = FT_THROW( Invalid_File_Format );
1457 goto Exit;
1458 }
1459
1460 parser->cursor++;
1461 }
1462
1463 Exit:
1464 return error;
1465 }
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
PS_Conv_ASCIIHexDecode(FT_Byte **cursor, FT_Byte *limit, FT_Byte *buffer, FT_Offset n)
Definition: psconv.c:464
ps_parser_skip_spaces(PS_Parser parser)
Definition: psobjs.c:615

◆ ps_parser_to_coord_array()

ps_parser_to_coord_array ( PS_Parser  parser,
FT_Int  max_coords,
FT_Short coords 
)

Definition at line 1478 of file psobjs.c.

1481 {
1483 return ps_tocoordarray( &parser->cursor, parser->limit,
1484 max_coords, coords );
1485 }
GLuint coords
Definition: glext.h:7368
static FT_Int ps_tocoordarray(FT_Byte **acur, FT_Byte *limit, FT_Int max_coords, FT_Short *coords)
Definition: psobjs.c:781

◆ ps_parser_to_fixed()

ps_parser_to_fixed ( PS_Parser  parser,
FT_Int  power_ten 
)

Definition at line 1469 of file psobjs.c.

1471 {
1473 return PS_Conv_ToFixed( &parser->cursor, parser->limit, power_ten );
1474 }

◆ ps_parser_to_fixed_array()

ps_parser_to_fixed_array ( PS_Parser  parser,
FT_Int  max_values,
FT_Fixed values,
FT_Int  power_ten 
)

Definition at line 1489 of file psobjs.c.

1493 {
1495 return ps_tofixedarray( &parser->cursor, parser->limit,
1496 max_values, values, power_ten );
1497 }
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666

◆ ps_parser_to_int()

ps_parser_to_int ( PS_Parser  parser)

Definition at line 1406 of file psobjs.c.

1407 {
1409 return PS_Conv_ToInt( &parser->cursor, parser->limit );
1410 }

◆ ps_parser_to_token()

ps_parser_to_token ( PS_Parser  parser,
T1_Token  token 
)

Definition at line 625 of file psobjs.c.

627 {
628 FT_Byte* cur;
629 FT_Byte* limit;
630 FT_Int embed;
631
632
634 token->start = NULL;
635 token->limit = NULL;
636
637 /* first of all, skip leading whitespace */
639
640 cur = parser->cursor;
641 limit = parser->limit;
642
643 if ( cur >= limit )
644 return;
645
646 switch ( *cur )
647 {
648 /************* check for literal string *****************/
649 case '(':
651 token->start = cur;
652
654 token->limit = cur;
655 break;
656
657 /************* check for programs/array *****************/
658 case '{':
660 token->start = cur;
661
662 if ( skip_procedure( &cur, limit ) == FT_Err_Ok )
663 token->limit = cur;
664 break;
665
666 /************* check for table/array ********************/
667 /* XXX: in theory we should also look for "<<" */
668 /* since this is semantically equivalent to "["; */
669 /* in practice it doesn't matter (?) */
670 case '[':
672 embed = 1;
673 token->start = cur++;
674
675 /* we need this to catch `[ ]' */
676 parser->cursor = cur;
678 cur = parser->cursor;
679
680 while ( cur < limit && !parser->error )
681 {
682 /* XXX: this is wrong because it does not */
683 /* skip comments, procedures, and strings */
684 if ( *cur == '[' )
685 embed++;
686 else if ( *cur == ']' )
687 {
688 embed--;
689 if ( embed <= 0 )
690 {
691 token->limit = ++cur;
692 break;
693 }
694 }
695
696 parser->cursor = cur;
698 /* we need this to catch `[XXX ]' */
700 cur = parser->cursor;
701 }
702 break;
703
704 /* ************ otherwise, it is any token **************/
705 default:
706 token->start = cur;
707 token->type = ( *cur == '/' ) ? T1_TOKEN_TYPE_KEY : T1_TOKEN_TYPE_ANY;
709 cur = parser->cursor;
710 if ( !parser->error )
711 token->limit = cur;
712 }
713
714 if ( !token->limit )
715 {
716 token->start = NULL;
718 }
719
720 parser->cursor = cur;
721 }
@ T1_TOKEN_TYPE_ANY
Definition: psaux.h:187
@ T1_TOKEN_TYPE_NONE
Definition: psaux.h:186
ps_parser_skip_PS_token(PS_Parser parser)
Definition: psobjs.c:517

Referenced by ps_parser_load_field(), and ps_parser_to_token_array().

◆ ps_parser_to_token_array()

ps_parser_to_token_array ( PS_Parser  parser,
T1_Token  tokens,
FT_UInt  max_tokens,
FT_Int pnum_tokens 
)

Definition at line 728 of file psobjs.c.

732 {
733 T1_TokenRec master;
734
735
736 *pnum_tokens = -1;
737
738 /* this also handles leading whitespace */
739 ps_parser_to_token( parser, &master );
740
741 if ( master.type == T1_TOKEN_TYPE_ARRAY )
742 {
743 FT_Byte* old_cursor = parser->cursor;
744 FT_Byte* old_limit = parser->limit;
745 T1_Token cur = tokens;
746 T1_Token limit = cur + max_tokens;
747
748
749 /* don't include outermost delimiters */
750 parser->cursor = master.start + 1;
751 parser->limit = master.limit - 1;
752
753 while ( parser->cursor < parser->limit )
754 {
756
757
759 if ( !token.type )
760 break;
761
762 if ( tokens && cur < limit )
763 *cur = token;
764
765 cur++;
766 }
767
768 *pnum_tokens = (FT_Int)( cur - tokens );
769
770 parser->cursor = old_cursor;
771 parser->limit = old_limit;
772 }
773 }
FT_Byte * start
Definition: psaux.h:201
FT_Byte * limit
Definition: psaux.h:202

Referenced by ps_parser_load_field_table().

◆ ps_table_add()

ps_table_add ( PS_Table  table,
FT_Int  idx,
const void object,
FT_UInt  length 
)

Definition at line 176 of file psobjs.c.

180 {
181 if ( idx < 0 || idx >= table->max_elems )
182 {
183 FT_ERROR(( "ps_table_add: invalid index\n" ));
184 return FT_THROW( Invalid_Argument );
185 }
186
187 /* grow the base block if needed */
188 if ( table->cursor + length > table->capacity )
189 {
191 FT_Offset new_size = table->capacity;
192 FT_PtrDist in_offset;
193
194
195 in_offset = (FT_Byte*)object - table->block;
196 if ( in_offset < 0 || (FT_Offset)in_offset >= table->capacity )
197 in_offset = -1;
198
199 while ( new_size < table->cursor + length )
200 {
201 /* increase size by 25% and round up to the nearest multiple
202 of 1024 */
203 new_size += ( new_size >> 2 ) + 1;
204 new_size = FT_PAD_CEIL( new_size, 1024 );
205 }
206
208 if ( error )
209 return error;
210
211 if ( in_offset >= 0 )
212 object = table->block + in_offset;
213 }
214
215 /* add the object to the base block and adjust offset */
216 table->elements[idx] = FT_OFFSET( table->block, table->cursor );
217 table->lengths [idx] = length;
218 FT_MEM_COPY( table->block + table->cursor, object, length );
219
220 table->cursor += length;
221 return FT_Err_Ok;
222 }
size_t const new_size
Definition: expand.cpp:66
#define FT_OFFSET(base, count)
Definition: ftmemory.h:66
#define FT_PAD_CEIL(x, n)
Definition: ftobjs.h:89
ft_ptrdiff_t FT_PtrDist
Definition: fttypes.h:336
size_t FT_Offset
Definition: fttypes.h:323
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
static FT_Error reallocate_t1_table(PS_Table table, FT_Offset new_size)
Definition: psobjs.c:120

◆ ps_table_done()

ps_table_done ( PS_Table  table)

Definition at line 243 of file psobjs.c.

244 {
245 FT_Memory memory = table->memory;
247 FT_Byte* old_base = table->block;
248
249
250 /* should never fail, because rec.cursor <= rec.size */
251 if ( !old_base )
252 return;
253
254 if ( FT_ALLOC( table->block, table->cursor ) )
255 return;
256 FT_MEM_COPY( table->block, old_base, table->cursor );
257 shift_elements( table, old_base );
258
259 table->capacity = table->cursor;
260 FT_FREE( old_base );
261
262 FT_UNUSED( error );
263 }
static void shift_elements(PS_Table table, FT_Byte *old_base)
Definition: psobjs.c:103

◆ ps_table_new()

ps_table_new ( PS_Table  table,
FT_Int  count,
FT_Memory  memory 
)

Definition at line 73 of file psobjs.c.

76 {
78
79
80 table->memory = memory;
81 if ( FT_NEW_ARRAY( table->elements, count ) ||
82 FT_NEW_ARRAY( table->lengths, count ) )
83 goto Exit;
84
85 table->max_elems = count;
86 table->init = 0xDEADBEEFUL;
87 table->num_elems = 0;
88 table->block = NULL;
89 table->capacity = 0;
90 table->cursor = 0;
91
93
94 Exit:
95 if ( error )
96 FT_FREE( table->elements );
97
98 return error;
99 }
FT_CALLBACK_TABLE_DEF const PS_Table_FuncsRec ps_table_funcs
Definition: psauxmod.c:32

◆ ps_table_release()

ps_table_release ( PS_Table  table)

Definition at line 267 of file psobjs.c.

268 {
269 FT_Memory memory = table->memory;
270
271
272 if ( (FT_ULong)table->init == 0xDEADBEEFUL )
273 {
274 FT_FREE( table->block );
275 FT_FREE( table->elements );
276 FT_FREE( table->lengths );
277 table->init = 0;
278 }
279 }
unsigned long FT_ULong
Definition: fttypes.h:253

◆ t1_builder_add_contour()

t1_builder_add_contour ( T1_Builder  builder)

Definition at line 1693 of file psobjs.c.

1694 {
1695 FT_Outline* outline = builder->current;
1697
1698
1699 /* this might happen in invalid fonts */
1700 if ( !outline )
1701 {
1702 FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" ));
1703 return FT_THROW( Invalid_File_Format );
1704 }
1705
1706 if ( !builder->load_points )
1707 {
1708 outline->n_contours++;
1709 return FT_Err_Ok;
1710 }
1711
1712 error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
1713 if ( !error )
1714 {
1715 if ( outline->n_contours > 0 )
1716 outline->contours[outline->n_contours - 1] =
1717 (short)( outline->n_points - 1 );
1718
1719 outline->n_contours++;
1720 }
1721
1722 return error;
1723 }

Referenced by t1_builder_start_point().

◆ t1_builder_add_point()

t1_builder_add_point ( T1_Builder  builder,
FT_Pos  x,
FT_Pos  y,
FT_Byte  flag 
)

Definition at line 1652 of file psobjs.c.

1656 {
1657 FT_Outline* outline = builder->current;
1658
1659
1660 if ( builder->load_points )
1661 {
1662 FT_Vector* point = outline->points + outline->n_points;
1663 FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
1664
1665
1666 point->x = FIXED_TO_INT( x );
1667 point->y = FIXED_TO_INT( y );
1669 }
1670 outline->n_points++;
1671 }

Referenced by t1_builder_add_point1().

◆ t1_builder_add_point1()

t1_builder_add_point1 ( T1_Builder  builder,
FT_Pos  x,
FT_Pos  y 
)

Definition at line 1676 of file psobjs.c.

1679 {
1681
1682
1683 error = t1_builder_check_points( builder, 1 );
1684 if ( !error )
1685 t1_builder_add_point( builder, x, y, 1 );
1686
1687 return error;
1688 }
t1_builder_check_points(T1_Builder builder, FT_Int count)
Definition: psobjs.c:1643
t1_builder_add_point(T1_Builder builder, FT_Pos x, FT_Pos y, FT_Byte flag)
Definition: psobjs.c:1652

Referenced by t1_builder_start_point().

◆ t1_builder_check_points()

t1_builder_check_points ( T1_Builder  builder,
FT_Int  count 
)

Definition at line 1643 of file psobjs.c.

1645 {
1646 return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
1647 }

Referenced by t1_builder_add_point1().

◆ t1_builder_close_contour()

t1_builder_close_contour ( T1_Builder  builder)

Definition at line 1753 of file psobjs.c.

1754 {
1755 FT_Outline* outline = builder->current;
1756 FT_Int first;
1757
1758
1759 if ( !outline )
1760 return;
1761
1762 first = outline->n_contours <= 1
1763 ? 0 : outline->contours[outline->n_contours - 2] + 1;
1764
1765 /* in malformed fonts it can happen that a contour was started */
1766 /* but no points were added */
1767 if ( outline->n_contours && first == outline->n_points )
1768 {
1769 outline->n_contours--;
1770 return;
1771 }
1772
1773 /* We must not include the last point in the path if it */
1774 /* is located on the first point. */
1775 if ( outline->n_points > 1 )
1776 {
1777 FT_Vector* p1 = outline->points + first;
1778 FT_Vector* p2 = outline->points + outline->n_points - 1;
1779 FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
1780
1781
1782 /* `delete' last point only if it coincides with the first */
1783 /* point and it is not a control point (which can happen). */
1784 if ( p1->x == p2->x && p1->y == p2->y )
1785 if ( *control == FT_CURVE_TAG_ON )
1786 outline->n_points--;
1787 }
1788
1789 if ( outline->n_contours > 0 )
1790 {
1791 /* Don't add contours only consisting of one point, i.e., */
1792 /* check whether the first and the last point is the same. */
1793 if ( first == outline->n_points - 1 )
1794 {
1795 outline->n_contours--;
1796 outline->n_points--;
1797 }
1798 else
1799 outline->contours[outline->n_contours - 1] =
1800 (short)( outline->n_points - 1 );
1801 }
1802 }

◆ t1_builder_done()

t1_builder_done ( T1_Builder  builder)

Definition at line 1631 of file psobjs.c.

1632 {
1633 FT_GlyphSlot glyph = builder->glyph;
1634
1635
1636 if ( glyph )
1637 glyph->outline = *builder->base;
1638 }

Referenced by t1_decoder_done().

◆ t1_builder_init()

t1_builder_init ( T1_Builder  builder,
FT_Face  face,
FT_Size  size,
FT_GlyphSlot  glyph,
FT_Bool  hinting 
)

Definition at line 1574 of file psobjs.c.

1579 {
1580 builder->parse_state = T1_Parse_Start;
1581 builder->load_points = 1;
1582
1583 builder->face = face;
1584 builder->glyph = glyph;
1585 builder->memory = face->memory;
1586
1587 if ( glyph )
1588 {
1589 FT_GlyphLoader loader = glyph->internal->loader;
1590
1591
1592 builder->loader = loader;
1593 builder->base = &loader->base.outline;
1594 builder->current = &loader->current.outline;
1595 FT_GlyphLoader_Rewind( loader );
1596
1597 builder->hints_globals = size->internal->module_data;
1598 builder->hints_funcs = NULL;
1599
1600 if ( hinting )
1601 builder->hints_funcs = glyph->internal->glyph_hints;
1602 }
1603
1604 builder->pos_x = 0;
1605 builder->pos_y = 0;
1606
1607 builder->left_bearing.x = 0;
1608 builder->left_bearing.y = 0;
1609 builder->advance.x = 0;
1610 builder->advance.y = 0;
1611
1612 builder->funcs = t1_builder_funcs;
1613 }
@ T1_Parse_Start
Definition: psaux.h:755
FT_CALLBACK_TABLE_DEF const T1_Builder_FuncsRec t1_builder_funcs
Definition: psauxmod.c:72
T1_Builder_FuncsRec funcs
Definition: psaux.h:852
void * hints_globals
Definition: psaux.h:850
void * hints_funcs
Definition: psaux.h:849
T1_ParseState parse_state
Definition: psaux.h:843

Referenced by t1_decoder_init().

◆ t1_builder_start_point()

t1_builder_start_point ( T1_Builder  builder,
FT_Pos  x,
FT_Pos  y 
)

Definition at line 1728 of file psobjs.c.

1731 {
1732 FT_Error error = FT_ERR( Invalid_File_Format );
1733
1734
1735 /* test whether we are building a new contour */
1736
1737 if ( builder->parse_state == T1_Parse_Have_Path )
1738 error = FT_Err_Ok;
1739 else
1740 {
1742 error = t1_builder_add_contour( builder );
1743 if ( !error )
1744 error = t1_builder_add_point1( builder, x, y );
1745 }
1746
1747 return error;
1748 }
@ T1_Parse_Have_Path
Definition: psaux.h:758
t1_builder_add_point1(T1_Builder builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:1676
t1_builder_add_contour(T1_Builder builder)
Definition: psobjs.c:1693

◆ t1_decrypt()

t1_decrypt ( FT_Byte buffer,
FT_Offset  length,
FT_UShort  seed 
)

Definition at line 2574 of file psobjs.c.

2577 {
2580 buffer,
2581 length,
2582 &seed );
2583 }
GLuint buffer
Definition: glext.h:5915
PS_Conv_EexecDecode(FT_Byte **cursor, FT_Byte *limit, FT_Byte *buffer, FT_Offset n, FT_UShort *seed)
Definition: psconv.c:557

◆ t1_make_subfont()

t1_make_subfont ( FT_Face  face,
PS_Private  priv,
CFF_SubFont  subfont 
)

Definition at line 2489 of file psobjs.c.

2492 {
2493 CFF_Private cpriv = &subfont->private_dict;
2494 FT_UInt n, count;
2495
2496
2497 FT_ZERO( subfont );
2498 FT_ZERO( cpriv );
2499
2500 count = cpriv->num_blue_values = priv->num_blue_values;
2501 for ( n = 0; n < count; n++ )
2502 cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
2503
2504 count = cpriv->num_other_blues = priv->num_other_blues;
2505 for ( n = 0; n < count; n++ )
2506 cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
2507
2508 count = cpriv->num_family_blues = priv->num_family_blues;
2509 for ( n = 0; n < count; n++ )
2510 cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
2511
2513 for ( n = 0; n < count; n++ )
2515
2516 cpriv->blue_scale = priv->blue_scale;
2517 cpriv->blue_shift = (FT_Pos)priv->blue_shift;
2518 cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz;
2519
2520 cpriv->standard_width = (FT_Pos)priv->standard_width[0];
2521 cpriv->standard_height = (FT_Pos)priv->standard_height[0];
2522
2523 count = cpriv->num_snap_widths = priv->num_snap_widths;
2524 for ( n = 0; n < count; n++ )
2525 cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n];
2526
2527 count = cpriv->num_snap_heights = priv->num_snap_heights;
2528 for ( n = 0; n < count; n++ )
2529 cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n];
2530
2531 cpriv->force_bold = priv->force_bold;
2532 cpriv->lenIV = priv->lenIV;
2533 cpriv->language_group = priv->language_group;
2534 cpriv->expansion_factor = priv->expansion_factor;
2535
2536 cpriv->subfont = subfont;
2537
2538
2539 /* Initialize the random number generator. */
2540 if ( face->internal->random_seed != -1 )
2541 {
2542 /* If we have a face-specific seed, use it. */
2543 /* If non-zero, update it to a positive value. */
2544 subfont->random = (FT_UInt32)face->internal->random_seed;
2545 if ( face->internal->random_seed )
2546 {
2547 do
2548 {
2549 face->internal->random_seed = (FT_Int32)cff_random(
2550 (FT_UInt32)face->internal->random_seed );
2551
2552 } while ( face->internal->random_seed < 0 );
2553 }
2554 }
2555 if ( !subfont->random )
2556 {
2557 FT_UInt32 seed;
2558
2559
2560 /* compute random seed from some memory addresses */
2561 seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
2562 (FT_Offset)(char*)&face ^
2563 (FT_Offset)(char*)&subfont );
2564 seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
2565 if ( seed == 0 )
2566 seed = 0x7384;
2567
2568 subfont->random = seed;
2569 }
2570 }
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
GLdouble n
Definition: glext.h:7729
cff_random(FT_UInt32 r)
Definition: psobjs.c:2587
FT_Byte num_snap_heights
Definition: cfftypes.h:263
FT_Byte num_blue_values
Definition: cfftypes.h:246
FT_Int language_group
Definition: cfftypes.h:269
CFF_SubFont subfont
Definition: cfftypes.h:278
FT_Pos other_blues[10]
Definition: cfftypes.h:252
FT_Byte num_snap_widths
Definition: cfftypes.h:262
FT_Int lenIV
Definition: cfftypes.h:268
FT_Fixed blue_scale
Definition: cfftypes.h:256
FT_Pos snap_heights[13]
Definition: cfftypes.h:265
FT_Pos snap_widths[13]
Definition: cfftypes.h:264
FT_Pos blue_values[14]
Definition: cfftypes.h:251
FT_Byte num_family_blues
Definition: cfftypes.h:248
FT_Pos standard_width
Definition: cfftypes.h:259
FT_Byte num_other_blues
Definition: cfftypes.h:247
FT_Pos family_other_blues[10]
Definition: cfftypes.h:254
FT_Byte num_family_other_blues
Definition: cfftypes.h:249
FT_Pos standard_height
Definition: cfftypes.h:260
FT_Pos blue_fuzz
Definition: cfftypes.h:258
FT_Bool force_bold
Definition: cfftypes.h:266
FT_Fixed expansion_factor
Definition: cfftypes.h:270
FT_Pos blue_shift
Definition: cfftypes.h:257
FT_Pos family_blues[14]
Definition: cfftypes.h:253
FT_UInt32 random
Definition: cfftypes.h:329
CFF_PrivateRec private_dict
Definition: cfftypes.h:305
FT_Byte num_snap_widths
Definition: t1tables.h:159
FT_Byte num_other_blues
Definition: t1tables.h:142
FT_UShort standard_width[1]
Definition: t1tables.h:156
FT_Byte num_family_blues
Definition: t1tables.h:143
FT_Int blue_fuzz
Definition: t1tables.h:154
FT_Short snap_heights[13]
Definition: t1tables.h:165
FT_Short snap_widths[13]
Definition: t1tables.h:164
FT_Bool force_bold
Definition: t1tables.h:161
FT_Fixed expansion_factor
Definition: t1tables.h:167
FT_Byte num_snap_heights
Definition: t1tables.h:160
FT_Short other_blues[10]
Definition: t1tables.h:147
FT_Byte num_family_other_blues
Definition: t1tables.h:144
FT_Int lenIV
Definition: t1tables.h:139
FT_UShort standard_height[1]
Definition: t1tables.h:157
FT_Short family_blues[14]
Definition: t1tables.h:149
FT_Int blue_shift
Definition: t1tables.h:153
FT_Short family_other_blues[10]
Definition: t1tables.h:150
FT_Short blue_values[14]
Definition: t1tables.h:146
FT_Byte num_blue_values
Definition: t1tables.h:141
FT_Fixed blue_scale
Definition: t1tables.h:152
FT_Long language_group
Definition: t1tables.h:169

Variable Documentation

◆ ps_parser_funcs

Definition at line 43 of file psobjs.h.

◆ ps_table_funcs

Definition at line 40 of file psobjs.h.

◆ t1_builder_funcs

Definition at line 46 of file psobjs.h.