ReactOS  0.4.13-dev-982-g9853eab
psobjs.c File Reference
#include <ft2build.h>
#include "psobjs.h"
#include "psconv.h"
#include "psauxerr.h"
#include "psauxmod.h"
Include dependency graph for psobjs.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_COMPONENT   trace_psobjs
 
#define IS_OCTAL_DIGIT(c)   ( '0' <= (c) && (c) <= '7' )
 
#define T1_MAX_TABLE_ELEMENTS   32
 

Functions

 ps_table_new (PS_Table table, FT_Int count, FT_Memory memory)
 
static void shift_elements (PS_Table table, FT_Byte *old_base)
 
static FT_Error reallocate_t1_table (PS_Table table, FT_Offset new_size)
 
 ps_table_add (PS_Table table, FT_Int idx, void *object, FT_UInt length)
 
 ps_table_done (PS_Table table)
 
 ps_table_release (PS_Table table)
 
static void skip_comment (FT_Byte **acur, FT_Byte *limit)
 
static void skip_spaces (FT_Byte **acur, FT_Byte *limit)
 
static FT_Error skip_literal_string (FT_Byte **acur, FT_Byte *limit)
 
static FT_Error skip_string (FT_Byte **acur, FT_Byte *limit)
 
static FT_Error skip_procedure (FT_Byte **acur, FT_Byte *limit)
 
 ps_parser_skip_PS_token (PS_Parser parser)
 
 ps_parser_skip_spaces (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)
 
static FT_Int ps_tocoordarray (FT_Byte **acur, FT_Byte *limit, FT_Int max_coords, FT_Short *coords)
 
static FT_Int ps_tofixedarray (FT_Byte **acur, FT_Byte *limit, FT_Int max_values, FT_Fixed *values, FT_Int power_ten)
 
static int ps_tobool (FT_Byte **acur, FT_Byte *limit)
 
 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_add_contour (CFF_Builder *builder)
 
 cff_builder_start_point (CFF_Builder *builder, FT_Pos x, FT_Pos y)
 
 cff_builder_close_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)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_psobjs

Definition at line 39 of file psobjs.c.

◆ IS_OCTAL_DIGIT

#define IS_OCTAL_DIGIT (   c)    ( '0' <= (c) && (c) <= '7' )

Definition at line 328 of file psobjs.c.

◆ T1_MAX_TABLE_ELEMENTS

#define T1_MAX_TABLE_ELEMENTS   32

Definition at line 1293 of file psobjs.c.

Function Documentation

◆ cff_builder_add_contour()

cff_builder_add_contour ( CFF_Builder builder)

Definition at line 1934 of file psobjs.c.

1935  {
1936  FT_Outline* outline = builder->current;
1937  FT_Error error;
1938 
1939 
1940  if ( !builder->load_points )
1941  {
1942  outline->n_contours++;
1943  return FT_Err_Ok;
1944  }
1945 
1946  error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
1947  if ( !error )
1948  {
1949  if ( outline->n_contours > 0 )
1950  outline->contours[outline->n_contours - 1] =
1951  (short)( outline->n_points - 1 );
1952 
1953  outline->n_contours++;
1954  }
1955 
1956  return error;
1957  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
FT_GlyphLoader loader
Definition: psaux.h:1048
FT_Outline * current
Definition: psaux.h:1050
Definition: mesh.c:5329
FT_Bool load_points
Definition: psaux.h:1061
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
Definition: ftgloadr.h:118

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 1879 of file psobjs.c.

1883  {
1884  FT_Outline* outline = builder->current;
1885 
1886 
1887  if ( builder->load_points )
1888  {
1889  FT_Vector* point = outline->points + outline->n_points;
1890  FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
1891 
1893  PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
1894 
1895 
1896  if ( driver->hinting_engine == FT_HINTING_FREETYPE )
1897  {
1898  point->x = x >> 16;
1899  point->y = y >> 16;
1900  }
1901  else
1902 #endif
1903  {
1904  /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
1905  point->x = x >> 10;
1906  point->y = y >> 10;
1907  }
1908  *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
1909  }
1910 
1911  outline->n_points++;
1912  }
#define CFF_CONFIG_OPTION_OLD_ENGINE
Definition: ftoption.h:797
#define FT_HINTING_FREETYPE
Definition: ftdriver.h:345
#define FT_CURVE_TAG_CUBIC
Definition: ftimage.h:455
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL point
Definition: edittest.c:50
FT_BEGIN_HEADER struct PS_DriverRec_ * PS_Driver
LONG y
Definition: windef.h:315
struct @1603::@1604 driver
#define FT_FACE_DRIVER(x)
Definition: ftobjs.h:634
unsigned char FT_Byte
Definition: fttypes.h:154
FT_Outline * current
Definition: psaux.h:1050
LONG x
Definition: windef.h:314
TT_Face face
Definition: psaux.h:1046
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
Definition: mesh.c:5329
FT_Bool load_points
Definition: psaux.h:1061
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define FT_CURVE_TAG_ON
Definition: ftimage.h:453

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 1917 of file psobjs.c.

1920  {
1921  FT_Error error;
1922 
1923 
1924  error = cff_check_points( builder, 1 );
1925  if ( !error )
1926  cff_builder_add_point( builder, x, y, 1 );
1927 
1928  return error;
1929  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
cff_check_points(CFF_Builder *builder, FT_Int count)
Definition: psobjs.c:1870
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
cff_builder_add_point(CFF_Builder *builder, FT_Pos x, FT_Pos y, FT_Byte flag)
Definition: psobjs.c:1879

Referenced by cff_builder_start_point().

◆ cff_builder_close_contour()

cff_builder_close_contour ( CFF_Builder builder)

Definition at line 1984 of file psobjs.c.

1985  {
1986  FT_Outline* outline = builder->current;
1987  FT_Int first;
1988 
1989 
1990  if ( !outline )
1991  return;
1992 
1993  first = outline->n_contours <= 1
1994  ? 0 : outline->contours[outline->n_contours - 2] + 1;
1995 
1996  /* We must not include the last point in the path if it */
1997  /* is located on the first point. */
1998  if ( outline->n_points > 1 )
1999  {
2000  FT_Vector* p1 = outline->points + first;
2001  FT_Vector* p2 = outline->points + outline->n_points - 1;
2002  FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
2003 
2004 
2005  /* `delete' last point only if it coincides with the first */
2006  /* point and if it is not a control point (which can happen). */
2007  if ( p1->x == p2->x && p1->y == p2->y )
2008  if ( *control == FT_CURVE_TAG_ON )
2009  outline->n_points--;
2010  }
2011 
2012  if ( outline->n_contours > 0 )
2013  {
2014  /* Don't add contours only consisting of one point, i.e., */
2015  /* check whether begin point and last point are the same. */
2016  if ( first == outline->n_points - 1 )
2017  {
2018  outline->n_contours--;
2019  outline->n_points--;
2020  }
2021  else
2022  outline->contours[outline->n_contours - 1] =
2023  (short)( outline->n_points - 1 );
2024  }
2025  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
signed int FT_Int
Definition: fttypes.h:220
const GLint * first
Definition: glext.h:5794
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned char FT_Byte
Definition: fttypes.h:154
if(!(yy_init))
Definition: macro.lex.yy.c:714
FT_Outline * current
Definition: psaux.h:1050
Definition: mesh.c:5329
#define FT_CURVE_TAG_ON
Definition: ftimage.h:453

◆ cff_builder_done()

cff_builder_done ( CFF_Builder builder)

Definition at line 1858 of file psobjs.c.

1859  {
1860  CFF_GlyphSlot glyph = builder->glyph;
1861 
1862 
1863  if ( glyph )
1864  glyph->root.outline = *builder->base;
1865  }
FT_Outline * base
Definition: psaux.h:1049
FT_Outline outline
Definition: freetype.h:1927
CFF_GlyphSlot glyph
Definition: psaux.h:1047
FT_GlyphSlotRec root
Definition: cffotypes.h:62

◆ cff_builder_init()

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

Definition at line 1793 of file psobjs.c.

1798  {
1799  builder->path_begun = 0;
1800  builder->load_points = 1;
1801 
1802  builder->face = face;
1803  builder->glyph = glyph;
1804  builder->memory = face->root.memory;
1805 
1806  if ( glyph )
1807  {
1808  FT_GlyphLoader loader = glyph->root.internal->loader;
1809 
1810 
1811  builder->loader = loader;
1812  builder->base = &loader->base.outline;
1813  builder->current = &loader->current.outline;
1814  FT_GlyphLoader_Rewind( loader );
1815 
1816  builder->hints_globals = NULL;
1817  builder->hints_funcs = NULL;
1818 
1819  if ( hinting && size )
1820  {
1821  FT_Size ftsize = FT_SIZE( size );
1822  CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data;
1823 
1824  if ( internal )
1825  {
1826  builder->hints_globals = (void *)internal->topfont;
1827  builder->hints_funcs = glyph->root.internal->glyph_hints;
1828  }
1829  }
1830  }
1831 
1832  builder->pos_x = 0;
1833  builder->pos_y = 0;
1834 
1835  builder->left_bearing.x = 0;
1836  builder->left_bearing.y = 0;
1837  builder->advance.x = 0;
1838  builder->advance.y = 0;
1839 
1840  builder->funcs = cff_builder_funcs;
1841  }
FT_Pos y
Definition: ftimage.h:77
FT_Outline * base
Definition: psaux.h:1049
CFF_Builder_FuncsRec funcs
Definition: psaux.h:1069
FT_Size_Internal internal
Definition: freetype.h:1678
FT_Pos x
Definition: ftimage.h:76
FT_Bool path_begun
Definition: psaux.h:1060
FT_Vector left_bearing
Definition: psaux.h:1055
void * module_data
Definition: ftobjs.h:497
FT_Vector advance
Definition: psaux.h:1056
WORD face[3]
Definition: mesh.c:4747
FT_Memory memory
Definition: psaux.h:1045
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
FT_Outline outline
Definition: ftgloadr.h:52
FT_GlyphLoader loader
Definition: ftobjs.h:467
smooth NULL
Definition: ftsmooth.c:416
FT_Pos pos_x
Definition: psaux.h:1052
FT_GlyphLoader loader
Definition: psaux.h:1048
GLsizeiptr size
Definition: glext.h:5919
void * hints_globals
Definition: psaux.h:1067
if(!(yy_init))
Definition: macro.lex.yy.c:714
FT_Outline * current
Definition: psaux.h:1050
FT_Pos pos_y
Definition: psaux.h:1053
TT_Face face
Definition: psaux.h:1046
FT_GlyphLoadRec current
Definition: ftgloadr.h:70
FT_CALLBACK_TABLE_DEF const CFF_Builder_FuncsRec cff_builder_funcs
Definition: psauxmod.c:123
#define FT_SIZE(x)
Definition: ftobjs.h:631
void * hints_funcs
Definition: psaux.h:1066
FT_GlyphLoader_Rewind(FT_GlyphLoader loader)
Definition: ftgloadr.c:88
FT_Bool load_points
Definition: psaux.h:1061
ios_base &_STLP_CALL internal(ios_base &__s)
Definition: _ios_base.h:311
struct CFF_InternalRec_ * CFF_Internal
FT_Slot_Internal internal
Definition: freetype.h:1940
CFF_GlyphSlot glyph
Definition: psaux.h:1047
void * glyph_hints
Definition: ftobjs.h:472
FT_GlyphSlotRec root
Definition: cffotypes.h:62
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

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 1962 of file psobjs.c.

1965  {
1967 
1968 
1969  /* test whether we are building a new contour */
1970  if ( !builder->path_begun )
1971  {
1972  builder->path_begun = 1;
1973  error = cff_builder_add_contour( builder );
1974  if ( !error )
1975  error = cff_builder_add_point1( builder, x, y );
1976  }
1977 
1978  return error;
1979  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_Bool path_begun
Definition: psaux.h:1060
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
return FT_Err_Ok
Definition: ftbbox.c:511
cff_builder_add_contour(CFF_Builder *builder)
Definition: psobjs.c:1934
cff_builder_add_point1(CFF_Builder *builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:1917
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ cff_check_points()

cff_check_points ( CFF_Builder builder,
FT_Int  count 
)

Definition at line 1870 of file psobjs.c.

1872  {
1873  return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
1874  }
GLuint GLuint GLsizei count
Definition: gl.h:1545
FT_GlyphLoader loader
Definition: psaux.h:1048
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
Definition: ftgloadr.h:118

Referenced by cff_builder_add_point1().

◆ cff_random()

cff_random ( FT_UInt32  r)

Definition at line 2522 of file psobjs.c.

2523  {
2524  /* a 32bit version of the `xorshift' algorithm */
2525  r ^= r << 13;
2526  r ^= r >> 17;
2527  r ^= r << 5;
2528 
2529  return r;
2530  }
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 2221 of file psobjs.c.

2222  {
2223  FT_Outline* outline = builder->current;
2224  FT_Error error;
2225 
2226 
2227  /* this might happen in invalid fonts */
2228  if ( !outline )
2229  {
2230  FT_ERROR(( "ps_builder_add_contour: no outline to add points to\n" ));
2231  return FT_THROW( Invalid_File_Format );
2232  }
2233 
2234  if ( !builder->load_points )
2235  {
2236  outline->n_contours++;
2237  return FT_Err_Ok;
2238  }
2239 
2240  error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
2241  if ( !error )
2242  {
2243  if ( outline->n_contours > 0 )
2244  outline->contours[outline->n_contours - 1] =
2245  (short)( outline->n_points - 1 );
2246 
2247  outline->n_contours++;
2248  }
2249 
2250  return error;
2251  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_GlyphLoader loader
Definition: psaux.h:537
return FT_Err_Ok
Definition: ftbbox.c:511
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
FT_Outline * current
Definition: psaux.h:539
Definition: mesh.c:5329
FT_Bool load_points
Definition: psaux.h:549
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
Definition: ftgloadr.h:118

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 2154 of file psobjs.c.

2158  {
2159  FT_Outline* outline = builder->current;
2160 
2161 
2162  if ( builder->load_points )
2163  {
2164  FT_Vector* point = outline->points + outline->n_points;
2165  FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
2166 
2168  PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
2169 
2170 
2171  if ( !builder->is_t1 &&
2172  driver->hinting_engine == FT_HINTING_FREETYPE )
2173  {
2174  point->x = x >> 16;
2175  point->y = y >> 16;
2176  }
2177  else
2178 #endif
2179 #ifdef T1_CONFIG_OPTION_OLD_ENGINE
2180 #ifndef CFF_CONFIG_OPTION_OLD_ENGINE
2181  PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
2182 #endif
2183  if ( builder->is_t1 &&
2184  driver->hinting_engine == FT_HINTING_FREETYPE )
2185  {
2186  point->x = FIXED_TO_INT( x );
2187  point->y = FIXED_TO_INT( y );
2188  }
2189  else
2190 #endif
2191  {
2192  /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
2193  point->x = x >> 10;
2194  point->y = y >> 10;
2195  }
2196  *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
2197  }
2198  outline->n_points++;
2199  }
#define FIXED_TO_INT(x)
Definition: ftcalc.h:406
#define CFF_CONFIG_OPTION_OLD_ENGINE
Definition: ftoption.h:797
#define FT_HINTING_FREETYPE
Definition: ftdriver.h:345
#define FT_CURVE_TAG_CUBIC
Definition: ftimage.h:455
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL point
Definition: edittest.c:50
FT_BEGIN_HEADER struct PS_DriverRec_ * PS_Driver
LONG y
Definition: windef.h:315
struct @1603::@1604 driver
#define FT_FACE_DRIVER(x)
Definition: ftobjs.h:634
unsigned char FT_Byte
Definition: fttypes.h:154
FT_Bool is_t1
Definition: psaux.h:553
FT_Outline * current
Definition: psaux.h:539
LONG x
Definition: windef.h:314
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
Definition: mesh.c:5329
FT_Bool load_points
Definition: psaux.h:549
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define FT_CURVE_TAG_ON
Definition: ftimage.h:453
FT_Face face
Definition: psaux.h:535

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 2204 of file psobjs.c.

2207  {
2208  FT_Error error;
2209 
2210 
2211  error = ps_builder_check_points( builder, 1 );
2212  if ( !error )
2213  ps_builder_add_point( builder, x, y, 1 );
2214 
2215  return error;
2216  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
ps_builder_check_points(PS_Builder *builder, FT_Int count)
Definition: psobjs.c:2145
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
ps_builder_add_point(PS_Builder *builder, FT_Pos x, FT_Pos y, FT_Byte flag)
Definition: psobjs.c:2154

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 2145 of file psobjs.c.

2147  {
2148  return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
2149  }
FT_GlyphLoader loader
Definition: psaux.h:537
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
Definition: ftgloadr.h:118

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 2278 of file psobjs.c.

2279  {
2280  FT_Outline* outline = builder->current;
2281  FT_Int first;
2282 
2283 
2284  if ( !outline )
2285  return;
2286 
2287  first = outline->n_contours <= 1
2288  ? 0 : outline->contours[outline->n_contours - 2] + 1;
2289 
2290  /* in malformed fonts it can happen that a contour was started */
2291  /* but no points were added */
2292  if ( outline->n_contours && first == outline->n_points )
2293  {
2294  outline->n_contours--;
2295  return;
2296  }
2297 
2298  /* We must not include the last point in the path if it */
2299  /* is located on the first point. */
2300  if ( outline->n_points > 1 )
2301  {
2302  FT_Vector* p1 = outline->points + first;
2303  FT_Vector* p2 = outline->points + outline->n_points - 1;
2304  FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
2305 
2306 
2307  /* `delete' last point only if it coincides with the first */
2308  /* point and it is not a control point (which can happen). */
2309  if ( p1->x == p2->x && p1->y == p2->y )
2310  if ( *control == FT_CURVE_TAG_ON )
2311  outline->n_points--;
2312  }
2313 
2314  if ( outline->n_contours > 0 )
2315  {
2316  /* Don't add contours only consisting of one point, i.e., */
2317  /* check whether the first and the last point is the same. */
2318  if ( first == outline->n_points - 1 )
2319  {
2320  outline->n_contours--;
2321  outline->n_points--;
2322  }
2323  else
2324  outline->contours[outline->n_contours - 1] =
2325  (short)( outline->n_points - 1 );
2326  }
2327  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
signed int FT_Int
Definition: fttypes.h:220
const GLint * first
Definition: glext.h:5794
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned char FT_Byte
Definition: fttypes.h:154
FT_Outline * current
Definition: psaux.h:539
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: mesh.c:5329
#define FT_CURVE_TAG_ON
Definition: ftimage.h:453

Referenced by cf2_builder_moveTo(), cf2_interpT2CharString(), and cf2_outline_close().

◆ ps_builder_done()

ps_builder_done ( PS_Builder builder)

Definition at line 2133 of file psobjs.c.

2134  {
2135  CFF_GlyphSlot glyph = builder->glyph;
2136 
2137 
2138  if ( glyph )
2139  glyph->root.outline = *builder->base;
2140  }
FT_Outline * base
Definition: psaux.h:538
FT_Outline outline
Definition: freetype.h:1927
CFF_GlyphSlot glyph
Definition: psaux.h:536
FT_GlyphSlotRec root
Definition: cffotypes.h:62

◆ ps_builder_init()

ps_builder_init ( PS_Builder ps_builder,
void builder,
FT_Bool  is_t1 
)

Definition at line 2057 of file psobjs.c.

2060  {
2061  FT_ZERO( ps_builder );
2062 
2063  if ( is_t1 )
2064  {
2065  T1_Builder t1builder = (T1_Builder)builder;
2066 
2067 
2068  ps_builder->memory = t1builder->memory;
2069  ps_builder->face = (FT_Face)t1builder->face;
2070  ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph;
2071  ps_builder->loader = t1builder->loader;
2072  ps_builder->base = t1builder->base;
2073  ps_builder->current = t1builder->current;
2074 
2075  ps_builder->pos_x = &t1builder->pos_x;
2076  ps_builder->pos_y = &t1builder->pos_y;
2077 
2078  ps_builder->left_bearing = &t1builder->left_bearing;
2079  ps_builder->advance = &t1builder->advance;
2080 
2081  ps_builder->bbox = &t1builder->bbox;
2082  ps_builder->path_begun = 0;
2083  ps_builder->load_points = t1builder->load_points;
2084  ps_builder->no_recurse = t1builder->no_recurse;
2085 
2086  ps_builder->metrics_only = t1builder->metrics_only;
2087  }
2088  else
2089  {
2090  CFF_Builder* cffbuilder = (CFF_Builder*)builder;
2091 
2092 
2093  ps_builder->memory = cffbuilder->memory;
2094  ps_builder->face = (FT_Face)cffbuilder->face;
2095  ps_builder->glyph = cffbuilder->glyph;
2096  ps_builder->loader = cffbuilder->loader;
2097  ps_builder->base = cffbuilder->base;
2098  ps_builder->current = cffbuilder->current;
2099 
2100  ps_builder->pos_x = &cffbuilder->pos_x;
2101  ps_builder->pos_y = &cffbuilder->pos_y;
2102 
2103  ps_builder->left_bearing = &cffbuilder->left_bearing;
2104  ps_builder->advance = &cffbuilder->advance;
2105 
2106  ps_builder->bbox = &cffbuilder->bbox;
2107  ps_builder->path_begun = cffbuilder->path_begun;
2108  ps_builder->load_points = cffbuilder->load_points;
2109  ps_builder->no_recurse = cffbuilder->no_recurse;
2110 
2111  ps_builder->metrics_only = cffbuilder->metrics_only;
2112  }
2113 
2114  ps_builder->is_t1 = is_t1;
2115  ps_builder->funcs = ps_builder_funcs;
2116  }
FT_CALLBACK_TABLE_DEF const PS_Builder_FuncsRec ps_builder_funcs
Definition: psauxmod.c:65
FT_Memory memory
Definition: psaux.h:534
FT_Outline * base
Definition: psaux.h:1049
FT_Vector advance
Definition: psaux.h:793
FT_BBox bbox
Definition: psaux.h:1058
FT_GlyphLoader loader
Definition: psaux.h:537
FT_Outline * base
Definition: psaux.h:786
FT_GlyphSlot glyph
Definition: psaux.h:784
FT_Bool path_begun
Definition: psaux.h:1060
FT_Vector left_bearing
Definition: psaux.h:1055
FT_Bool metrics_only
Definition: psaux.h:800
FT_Vector advance
Definition: psaux.h:1056
FT_Memory memory
Definition: psaux.h:1045
FT_Bool metrics_only
Definition: psaux.h:1064
FT_Bool no_recurse
Definition: psaux.h:798
FT_Bool no_recurse
Definition: psaux.h:550
FT_Outline * base
Definition: psaux.h:538
PS_Builder_FuncsRec funcs
Definition: psaux.h:555
FT_Pos pos_x
Definition: psaux.h:1052
FT_GlyphLoader loader
Definition: psaux.h:1048
FT_Vector * left_bearing
Definition: psaux.h:544
FT_Bool is_t1
Definition: psaux.h:553
FT_Outline * current
Definition: psaux.h:539
#define FT_ZERO(p)
Definition: ftmemory.h:237
FT_Outline * current
Definition: psaux.h:1050
FT_Face face
Definition: psaux.h:783
FT_Pos pos_y
Definition: psaux.h:1053
FT_Memory memory
Definition: psaux.h:782
struct FT_FaceRec_ * FT_Face
Definition: freetype.h:503
FT_Pos pos_x
Definition: psaux.h:789
FT_Bool no_recurse
Definition: psaux.h:1062
FT_Vector left_bearing
Definition: psaux.h:792
FT_Outline * current
Definition: psaux.h:787
TT_Face face
Definition: psaux.h:1046
CFF_GlyphSlot glyph
Definition: psaux.h:536
FT_Vector * advance
Definition: psaux.h:545
FT_BBox * bbox
Definition: psaux.h:547
FT_BBox bbox
Definition: psaux.h:795
FT_Bool load_points
Definition: psaux.h:549
FT_Bool metrics_only
Definition: psaux.h:552
struct T1_BuilderRec_ * T1_Builder
Definition: psaux.h:667
FT_Pos * pos_y
Definition: psaux.h:542
FT_GlyphLoader loader
Definition: psaux.h:785
FT_Bool load_points
Definition: psaux.h:1061
FT_Bool load_points
Definition: psaux.h:797
CFF_GlyphSlot glyph
Definition: psaux.h:1047
FT_Face face
Definition: psaux.h:535
FT_Pos * pos_x
Definition: psaux.h:541
FT_Pos pos_y
Definition: psaux.h:790
FT_Bool path_begun
Definition: psaux.h:548

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 2256 of file psobjs.c.

2259  {
2261 
2262 
2263  /* test whether we are building a new contour */
2264  if ( !builder->path_begun )
2265  {
2266  builder->path_begun = 1;
2267  error = ps_builder_add_contour( builder );
2268  if ( !error )
2269  error = ps_builder_add_point1( builder, x, y );
2270  }
2271 
2272  return error;
2273  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
return FT_Err_Ok
Definition: ftbbox.c:511
ps_builder_add_point1(PS_Builder *builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:2204
ps_builder_add_contour(PS_Builder *builder)
Definition: psobjs.c:2221
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
FT_Bool path_begun
Definition: psaux.h:548

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 2357 of file psobjs.c.

2360  {
2361  FT_ZERO( ps_decoder );
2362 
2363  if ( is_t1 )
2364  {
2365  T1_Decoder t1_decoder = (T1_Decoder)decoder;
2366 
2367 
2368  ps_builder_init( &ps_decoder->builder,
2369  &t1_decoder->builder,
2370  is_t1 );
2371 
2372  ps_decoder->cf2_instance = &t1_decoder->cf2_instance;
2373  ps_decoder->psnames = t1_decoder->psnames;
2374 
2375  ps_decoder->num_glyphs = t1_decoder->num_glyphs;
2376  ps_decoder->glyph_names = t1_decoder->glyph_names;
2377  ps_decoder->hint_mode = t1_decoder->hint_mode;
2378  ps_decoder->blend = t1_decoder->blend;
2379 
2380  ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs;
2381  ps_decoder->locals = t1_decoder->subrs;
2382  ps_decoder->locals_len = t1_decoder->subrs_len;
2383  ps_decoder->locals_hash = t1_decoder->subrs_hash;
2384 
2385  ps_decoder->buildchar = t1_decoder->buildchar;
2386  ps_decoder->len_buildchar = t1_decoder->len_buildchar;
2387 
2388  ps_decoder->lenIV = t1_decoder->lenIV;
2389  }
2390  else
2391  {
2392  CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder;
2393 
2394 
2395  ps_builder_init( &ps_decoder->builder,
2396  &cff_decoder->builder,
2397  is_t1 );
2398 
2399  ps_decoder->cff = cff_decoder->cff;
2400  ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance;
2401  ps_decoder->current_subfont = cff_decoder->current_subfont;
2402 
2403  ps_decoder->num_globals = cff_decoder->num_globals;
2404  ps_decoder->globals = cff_decoder->globals;
2405  ps_decoder->globals_bias = cff_decoder->globals_bias;
2406  ps_decoder->num_locals = cff_decoder->num_locals;
2407  ps_decoder->locals = cff_decoder->locals;
2408  ps_decoder->locals_bias = cff_decoder->locals_bias;
2409 
2410  ps_decoder->glyph_width = &cff_decoder->glyph_width;
2411  ps_decoder->width_only = cff_decoder->width_only;
2412 
2413  ps_decoder->hint_mode = cff_decoder->hint_mode;
2414 
2415  ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback;
2416  ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback;
2417  }
2418  }
FT_Long * buildchar
Definition: psaux.h:652
FT_UInt num_locals
Definition: psaux.h:621
FT_UInt * locals_len
Definition: psaux.h:644
FT_UInt num_globals
Definition: psaux.h:622
CFF_Decoder_Free_Glyph_Callback free_glyph_callback
Definition: psaux.h:638
FT_Byte ** glyph_names
Definition: psaux.h:905
FT_UInt num_globals
Definition: psaux.h:1126
FT_Int lenIV
Definition: psaux.h:907
FT_Byte ** globals
Definition: psaux.h:1132
FT_UInt * subrs_len
Definition: psaux.h:910
FT_Generic cf2_instance
Definition: cfftypes.h:396
FT_Render_Mode hint_mode
Definition: psaux.h:1137
FT_Service_PsCMaps psnames
Definition: psaux.h:641
struct T1_DecoderRec_ * T1_Decoder
Definition: psaux.h:847
FT_Pos glyph_width
Definition: psaux.h:1117
CFF_SubFont current_subfont
Definition: psaux.h:614
FT_Service_PsCMaps psnames
Definition: psaux.h:903
CFF_Decoder_Free_Glyph_Callback free_glyph_callback
Definition: psaux.h:1144
CFF_SubFont current_subfont
Definition: psaux.h:1141
PS_Blend blend
Definition: psaux.h:920
FT_Byte ** globals
Definition: psaux.h:628
FT_Byte ** glyph_names
Definition: psaux.h:630
CFF_Builder builder
Definition: psaux.h:1104
FT_UInt num_locals
Definition: psaux.h:1125
FT_Bool width_only
Definition: psaux.h:1121
ps_builder_init(PS_Builder *ps_builder, void *builder, FT_Bool is_t1)
Definition: psobjs.c:2057
FT_Int globals_bias
Definition: psaux.h:1129
PS_Blend blend
Definition: psaux.h:650
FT_Int globals_bias
Definition: psaux.h:625
PS_Builder builder
Definition: psaux.h:601
FT_Bool width_only
Definition: psaux.h:618
FT_Long * buildchar
Definition: psaux.h:927
FT_UInt num_glyphs
Definition: psaux.h:631
#define FT_ZERO(p)
Definition: ftmemory.h:237
FT_Render_Mode hint_mode
Definition: psaux.h:633
FT_Byte ** locals
Definition: psaux.h:627
FT_Pos * glyph_width
Definition: psaux.h:617
FT_Hash locals_hash
Definition: psaux.h:645
T1_BuilderRec builder
Definition: psaux.h:895
FT_Byte ** locals
Definition: psaux.h:1131
CFF_Decoder_Get_Glyph_Callback get_glyph_callback
Definition: psaux.h:1143
FT_Byte ** subrs
Definition: psaux.h:909
CFF_Decoder_Get_Glyph_Callback get_glyph_callback
Definition: psaux.h:637
FT_Int locals_bias
Definition: psaux.h:1128
CFF_Font cff
Definition: psaux.h:1105
unsigned int FT_UInt
Definition: fttypes.h:231
FT_UInt len_buildchar
Definition: psaux.h:653
FT_UInt len_buildchar
Definition: psaux.h:928
FT_Generic * cf2_instance
Definition: psaux.h:615
FT_Int num_subrs
Definition: psaux.h:908
CFF_Font cff
Definition: psaux.h:613
FT_Int lenIV
Definition: psaux.h:643
FT_Render_Mode hint_mode
Definition: psaux.h:922
FT_Hash subrs_hash
Definition: psaux.h:911
FT_UInt num_glyphs
Definition: psaux.h:904
FT_Generic cf2_instance
Definition: psaux.h:932
FT_Int locals_bias
Definition: psaux.h:624

◆ ps_parser_done()

ps_parser_done ( PS_Parser  parser)

Definition at line 1498 of file psobjs.c.

1499  {
1500  FT_UNUSED( parser );
1501  }
Definition: import.c:86
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ ps_parser_init()

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

Definition at line 1483 of file psobjs.c.

1487  {
1488  parser->error = FT_Err_Ok;
1489  parser->base = base;
1490  parser->limit = limit;
1491  parser->cursor = base;
1492  parser->memory = memory;
1493  parser->funcs = ps_parser_funcs;
1494  }
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
GLint limit
Definition: glext.h:10326
GLuint base
Definition: 3dtext.c:35
FT_CALLBACK_TABLE_DEF const PS_Parser_FuncsRec ps_parser_funcs
Definition: psauxmod.c:43
unsigned int error
Definition: inffile.c:97
Definition: import.c:86

◆ 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 1025 of file psobjs.c.

1030  {
1032  FT_Byte* cur;
1033  FT_Byte* limit;
1034  FT_UInt count;
1035  FT_UInt idx;
1036  FT_Error error;
1038 
1039 
1040  /* this also skips leading whitespace */
1042  if ( !token.type )
1043  goto Fail;
1044 
1045  count = 1;
1046  idx = 0;
1047  cur = token.start;
1048  limit = token.limit;
1049 
1050  type = field->type;
1051 
1052  /* we must detect arrays in /FontBBox */
1053  if ( type == T1_FIELD_TYPE_BBOX )
1054  {
1055  T1_TokenRec token2;
1056  FT_Byte* old_cur = parser->cursor;
1057  FT_Byte* old_limit = parser->limit;
1058 
1059 
1060  /* don't include delimiters */
1061  parser->cursor = token.start + 1;
1062  parser->limit = token.limit - 1;
1063 
1064  ps_parser_to_token( parser, &token2 );
1065  parser->cursor = old_cur;
1066  parser->limit = old_limit;
1067 
1068  if ( token2.type == T1_TOKEN_TYPE_ARRAY )
1069  {
1071  goto FieldArray;
1072  }
1073  }
1074  else if ( token.type == T1_TOKEN_TYPE_ARRAY )
1075  {
1076  count = max_objects;
1077 
1078  FieldArray:
1079  /* if this is an array and we have no blend, an error occurs */
1080  if ( max_objects == 0 )
1081  goto Fail;
1082 
1083  idx = 1;
1084 
1085  /* don't include delimiters */
1086  cur++;
1087  limit--;
1088  }
1089 
1090  for ( ; count > 0; count--, idx++ )
1091  {
1092  FT_Byte* q = (FT_Byte*)objects[idx] + field->offset;
1093  FT_Long val;
1094  FT_String* string = NULL;
1095 
1096 
1097  skip_spaces( &cur, limit );
1098 
1099  switch ( type )
1100  {
1101  case T1_FIELD_TYPE_BOOL:
1102  val = ps_tobool( &cur, limit );
1103  goto Store_Integer;
1104 
1105  case T1_FIELD_TYPE_FIXED:
1106  val = PS_Conv_ToFixed( &cur, limit, 0 );
1107  goto Store_Integer;
1108 
1110  val = PS_Conv_ToFixed( &cur, limit, 3 );
1111  goto Store_Integer;
1112 
1113  case T1_FIELD_TYPE_INTEGER:
1114  val = PS_Conv_ToInt( &cur, limit );
1115  /* fall through */
1116 
1117  Store_Integer:
1118  switch ( field->size )
1119  {
1120  case (8 / FT_CHAR_BIT):
1121  *(FT_Byte*)q = (FT_Byte)val;
1122  break;
1123 
1124  case (16 / FT_CHAR_BIT):
1125  *(FT_UShort*)q = (FT_UShort)val;
1126  break;
1127 
1128  case (32 / FT_CHAR_BIT):
1129  *(FT_UInt32*)q = (FT_UInt32)val;
1130  break;
1131 
1132  default: /* for 64-bit systems */
1133  *(FT_Long*)q = val;
1134  }
1135  break;
1136 
1137  case T1_FIELD_TYPE_STRING:
1138  case T1_FIELD_TYPE_KEY:
1139  {
1140  FT_Memory memory = parser->memory;
1141  FT_UInt len = (FT_UInt)( limit - cur );
1142 
1143 
1144  if ( cur >= limit )
1145  break;
1146 
1147  /* we allow both a string or a name */
1148  /* for cases like /FontName (foo) def */
1149  if ( token.type == T1_TOKEN_TYPE_KEY )
1150  {
1151  /* don't include leading `/' */
1152  len--;
1153  cur++;
1154  }
1155  else if ( token.type == T1_TOKEN_TYPE_STRING )
1156  {
1157  /* don't include delimiting parentheses */
1158  /* XXX we don't handle <<...>> here */
1159  /* XXX should we convert octal escapes? */
1160  /* if so, what encoding should we use? */
1161  cur++;
1162  len -= 2;
1163  }
1164  else
1165  {
1166  FT_ERROR(( "ps_parser_load_field:"
1167  " expected a name or string\n"
1168  " "
1169  " but found token of type %d instead\n",
1170  token.type ));
1171  error = FT_THROW( Invalid_File_Format );
1172  goto Exit;
1173  }
1174 
1175  /* for this to work (FT_String**)q must have been */
1176  /* initialized to NULL */
1177  if ( *(FT_String**)q )
1178  {
1179  FT_TRACE0(( "ps_parser_load_field: overwriting field %s\n",
1180  field->ident ));
1181  FT_FREE( *(FT_String**)q );
1182  *(FT_String**)q = NULL;
1183  }
1184 
1185  if ( FT_ALLOC( string, len + 1 ) )
1186  goto Exit;
1187 
1188  FT_MEM_COPY( string, cur, len );
1189  string[len] = 0;
1190 
1191  *(FT_String**)q = string;
1192  }
1193  break;
1194 
1195  case T1_FIELD_TYPE_BBOX:
1196  {
1197  FT_Fixed temp[4];
1198  FT_BBox* bbox = (FT_BBox*)q;
1199  FT_Int result;
1200 
1201 
1202  result = ps_tofixedarray( &cur, limit, 4, temp, 0 );
1203 
1204  if ( result < 4 )
1205  {
1206  FT_ERROR(( "ps_parser_load_field:"
1207  " expected four integers in bounding box\n" ));
1208  error = FT_THROW( Invalid_File_Format );
1209  goto Exit;
1210  }
1211 
1212  bbox->xMin = FT_RoundFix( temp[0] );
1213  bbox->yMin = FT_RoundFix( temp[1] );
1214  bbox->xMax = FT_RoundFix( temp[2] );
1215  bbox->yMax = FT_RoundFix( temp[3] );
1216  }
1217  break;
1218 
1219  case T1_FIELD_TYPE_MM_BBOX:
1220  {
1221  FT_Memory memory = parser->memory;
1222  FT_Fixed* temp = NULL;
1223  FT_Int result;
1224  FT_UInt i;
1225 
1226 
1227  if ( FT_NEW_ARRAY( temp, max_objects * 4 ) )
1228  goto Exit;
1229 
1230  for ( i = 0; i < 4; i++ )
1231  {
1232  result = ps_tofixedarray( &cur, limit, (FT_Int)max_objects,
1233  temp + i * max_objects, 0 );
1234  if ( result < 0 || (FT_UInt)result < max_objects )
1235  {
1236  FT_ERROR(( "ps_parser_load_field:"
1237  " expected %d integer%s in the %s subarray\n"
1238  " "
1239  " of /FontBBox in the /Blend dictionary\n",
1240  max_objects, max_objects > 1 ? "s" : "",
1241  i == 0 ? "first"
1242  : ( i == 1 ? "second"
1243  : ( i == 2 ? "third"
1244  : "fourth" ) ) ));
1245  error = FT_THROW( Invalid_File_Format );
1246 
1247  FT_FREE( temp );
1248  goto Exit;
1249  }
1250 
1251  skip_spaces( &cur, limit );
1252  }
1253 
1254  for ( i = 0; i < max_objects; i++ )
1255  {
1256  FT_BBox* bbox = (FT_BBox*)objects[i];
1257 
1258 
1259  bbox->xMin = FT_RoundFix( temp[i ] );
1260  bbox->yMin = FT_RoundFix( temp[i + max_objects] );
1261  bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] );
1262  bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] );
1263  }
1264 
1265  FT_FREE( temp );
1266  }
1267  break;
1268 
1269  default:
1270  /* an error occurred */
1271  goto Fail;
1272  }
1273  }
1274 
1275 #if 0 /* obsolete -- keep for reference */
1276  if ( pflags )
1277  *pflags |= 1L << field->flag_bit;
1278 #else
1279  FT_UNUSED( pflags );
1280 #endif
1281 
1282  error = FT_Err_Ok;
1283 
1284  Exit:
1285  return error;
1286 
1287  Fail:
1288  error = FT_THROW( Invalid_File_Format );
1289  goto Exit;
1290  }
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
int FT_Error
Definition: fttypes.h:300
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
PS_Conv_ToFixed(FT_Byte **cursor, FT_Byte *limit, FT_Long power_ten)
Definition: psconv.c:196
enum T1_FieldType_ T1_FieldType
signed int FT_Int
Definition: fttypes.h:220
GLuint GLuint GLsizei count
Definition: gl.h:1545
FT_BBox bbox
Definition: ftbbox.c:446
FT_RoundFix(FT_Fixed a)
Definition: ftcalc.c:88
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
GLint limit
Definition: glext.h:10326
ps_parser_to_token(PS_Parser parser, T1_Token token)
Definition: psobjs.c:618
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
static const CLSID * objects[]
Definition: apphelp.c:109
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_THROW(e)
Definition: ftdebug.h:213
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
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
FT_Pos yMax
Definition: ftimage.h:118
#define FT_FREE(ptr)
Definition: ftmemory.h:329
GLuint GLfloat * val
Definition: glext.h:7180
T1_TokenType type
Definition: psaux.h:194
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
char FT_String
Definition: fttypes.h:187
FT_Pos xMin
Definition: ftimage.h:117
Definition: parser.c:43
static void Exit(void)
Definition: sock.c:1331
static void skip_spaces(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:305
FT_Pos xMax
Definition: ftimage.h:118
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:853
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
static int ps_tobool(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:989
static const WCHAR L[]
Definition: oid.c:1250
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
GLenum GLsizei len
Definition: glext.h:6722
#define FT_CHAR_BIT
Definition: ftconfig.h:70
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:333
Definition: hiveinit.c:368
signed long FT_Fixed
Definition: fttypes.h:288
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int FT_UInt
Definition: fttypes.h:231
FT_Pos yMin
Definition: ftimage.h:117
Definition: import.c:86
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:228
PS_Conv_ToInt(FT_Byte **cursor, FT_Byte *limit)
Definition: psconv.c:162
unsigned short FT_UShort
Definition: fttypes.h:209
GLuint64EXT * result
Definition: glext.h:11304
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

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 1297 of file psobjs.c.

1302  {
1304  T1_Token token;
1305  FT_Int num_elements;
1307  FT_Byte* old_cursor;
1308  FT_Byte* old_limit;
1309  T1_FieldRec fieldrec = *(T1_Field)field;
1310 
1311 
1312  fieldrec.type = T1_FIELD_TYPE_INTEGER;
1315  fieldrec.type = T1_FIELD_TYPE_FIXED;
1316 
1317  ps_parser_to_token_array( parser, elements,
1318  T1_MAX_TABLE_ELEMENTS, &num_elements );
1319  if ( num_elements < 0 )
1320  {
1321  error = FT_ERR( Ignore );
1322  goto Exit;
1323  }
1324  if ( (FT_UInt)num_elements > field->array_max )
1325  num_elements = (FT_Int)field->array_max;
1326 
1327  old_cursor = parser->cursor;
1328  old_limit = parser->limit;
1329 
1330  /* we store the elements count if necessary; */
1331  /* we further assume that `count_offset' can't be zero */
1332  if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
1333  *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
1334  (FT_Byte)num_elements;
1335 
1336  /* we now load each element, adjusting the field.offset on each one */
1337  token = elements;
1338  for ( ; num_elements > 0; num_elements--, token++ )
1339  {
1340  parser->cursor = token->start;
1341  parser->limit = token->limit;
1342 
1344  &fieldrec,
1345  objects,
1346  max_objects,
1347  0 );
1348  if ( error )
1349  break;
1350 
1351  fieldrec.offset += fieldrec.size;
1352  }
1353 
1354 #if 0 /* obsolete -- keep for reference */
1355  if ( pflags )
1356  *pflags |= 1L << field->flag_bit;
1357 #else
1358  FT_UNUSED( pflags );
1359 #endif
1360 
1361  parser->cursor = old_cursor;
1362  parser->limit = old_limit;
1363 
1364  Exit:
1365  return error;
1366  }
int FT_Error
Definition: fttypes.h:300
T1_FieldType type
Definition: psaux.h:249
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
return FT_Err_Ok
Definition: ftbbox.c:511
static const CLSID * objects[]
Definition: apphelp.c:109
unsigned char FT_Byte
Definition: fttypes.h:154
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
FT_UInt offset
Definition: psaux.h:251
struct T1_FieldRec_ * T1_Field
Definition: psaux.h:171
#define FT_ERR(e)
Definition: fttypes.h:586
ps_parser_load_field(PS_Parser parser, const T1_Field field, void **objects, FT_UInt max_objects, FT_ULong *pflags)
Definition: psobjs.c:1025
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: parser.c:43
static void Exit(void)
Definition: sock.c:1331
static const WCHAR L[]
Definition: oid.c:1250
unsigned int FT_UInt
Definition: fttypes.h:231
#define T1_MAX_TABLE_ELEMENTS
Definition: psobjs.c:1293
Definition: import.c:86
FT_Byte size
Definition: psaux.h:252
ps_parser_to_token_array(PS_Parser parser, T1_Token tokens, FT_UInt max_tokens, FT_Int *pnum_tokens)
Definition: psobjs.c:721
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ ps_parser_skip_PS_token()

ps_parser_skip_PS_token ( PS_Parser  parser)

Definition at line 510 of file psobjs.c.

511  {
512  /* Note: PostScript allows any non-delimiting, non-whitespace */
513  /* character in a name (PS Ref Manual, 3rd ed, p31). */
514  /* PostScript delimiters are (, ), <, >, [, ], {, }, /, and %. */
515 
516  FT_Byte* cur = parser->cursor;
517  FT_Byte* limit = parser->limit;
519 
520 
521  skip_spaces( &cur, limit ); /* this also skips comments */
522  if ( cur >= limit )
523  goto Exit;
524 
525  /* self-delimiting, single-character tokens */
526  if ( *cur == '[' || *cur == ']' )
527  {
528  cur++;
529  goto Exit;
530  }
531 
532  /* skip balanced expressions (procedures and strings) */
533 
534  if ( *cur == '{' ) /* {...} */
535  {
536  error = skip_procedure( &cur, limit );
537  goto Exit;
538  }
539 
540  if ( *cur == '(' ) /* (...) */
541  {
542  error = skip_literal_string( &cur, limit );
543  goto Exit;
544  }
545 
546  if ( *cur == '<' ) /* <...> */
547  {
548  if ( cur + 1 < limit && *(cur + 1) == '<' ) /* << */
549  {
550  cur++;
551  cur++;
552  }
553  else
554  error = skip_string( &cur, limit );
555 
556  goto Exit;
557  }
558 
559  if ( *cur == '>' )
560  {
561  cur++;
562  if ( cur >= limit || *cur != '>' ) /* >> */
563  {
564  FT_ERROR(( "ps_parser_skip_PS_token:"
565  " unexpected closing delimiter `>'\n" ));
566  error = FT_THROW( Invalid_File_Format );
567  goto Exit;
568  }
569  cur++;
570  goto Exit;
571  }
572 
573  if ( *cur == '/' )
574  cur++;
575 
576  /* anything else */
577  while ( cur < limit )
578  {
579  /* *cur might be invalid (e.g., ')' or '}'), but this */
580  /* is handled by the test `cur == parser->cursor' below */
581  if ( IS_PS_DELIM( *cur ) )
582  break;
583 
584  cur++;
585  }
586 
587  Exit:
588  if ( cur < limit && cur == parser->cursor )
589  {
590  FT_ERROR(( "ps_parser_skip_PS_token:"
591  " current token is `%c' which is self-delimiting\n"
592  " "
593  " but invalid at this point\n",
594  *cur ));
595 
596  error = FT_THROW( Invalid_File_Format );
597  }
598 
599  if ( cur > limit )
600  cur = limit;
601 
602  parser->error = error;
603  parser->cursor = cur;
604  }
int FT_Error
Definition: fttypes.h:300
static FT_Error skip_string(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:411
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
GLint limit
Definition: glext.h:10326
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_THROW(e)
Definition: ftdebug.h:213
static void Exit(void)
Definition: sock.c:1331
static void skip_spaces(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:305
unsigned int error
Definition: inffile.c:97
static FT_Error skip_literal_string(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:335
const char cursor[]
Definition: icontest.c:13
static FT_Error skip_procedure(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:450
Definition: import.c:86
#define IS_PS_DELIM(ch)
Definition: psaux.h:1344

Referenced by ps_parser_to_token().

◆ ps_parser_skip_spaces()

ps_parser_skip_spaces ( PS_Parser  parser)

Definition at line 608 of file psobjs.c.

609  {
610  skip_spaces( &parser->cursor, parser->limit );
611  }
static void skip_spaces(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:305
Definition: import.c:86

Referenced by ps_parser_to_bytes(), ps_parser_to_coord_array(), ps_parser_to_fixed(), ps_parser_to_fixed_array(), ps_parser_to_int(), and ps_parser_to_token().

◆ 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 1380 of file psobjs.c.

1385  {
1387  FT_Byte* cur;
1388 
1389 
1391  cur = parser->cursor;
1392 
1393  if ( cur >= parser->limit )
1394  goto Exit;
1395 
1396  if ( delimiters )
1397  {
1398  if ( *cur != '<' )
1399  {
1400  FT_ERROR(( "ps_parser_to_bytes: Missing starting delimiter `<'\n" ));
1401  error = FT_THROW( Invalid_File_Format );
1402  goto Exit;
1403  }
1404 
1405  cur++;
1406  }
1407 
1408  *pnum_bytes = PS_Conv_ASCIIHexDecode( &cur,
1409  parser->limit,
1410  bytes,
1411  max_bytes );
1412 
1413  if ( delimiters )
1414  {
1415  if ( cur < parser->limit && *cur != '>' )
1416  {
1417  FT_ERROR(( "ps_parser_to_bytes: Missing closing delimiter `>'\n" ));
1418  error = FT_THROW( Invalid_File_Format );
1419  goto Exit;
1420  }
1421 
1422  cur++;
1423  }
1424 
1425  parser->cursor = cur;
1426 
1427  Exit:
1428  return error;
1429  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
GLint limit
Definition: glext.h:10326
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_THROW(e)
Definition: ftdebug.h:213
ps_parser_skip_spaces(PS_Parser parser)
Definition: psobjs.c:608
PS_Conv_ASCIIHexDecode(FT_Byte **cursor, FT_Byte *limit, FT_Byte *buffer, FT_Offset n)
Definition: psconv.c:465
static void Exit(void)
Definition: sock.c:1331
Definition: import.c:86

◆ ps_parser_to_coord_array()

ps_parser_to_coord_array ( PS_Parser  parser,
FT_Int  max_coords,
FT_Short coords 
)

Definition at line 1442 of file psobjs.c.

1445  {
1447  return ps_tocoordarray( &parser->cursor, parser->limit,
1448  max_coords, coords );
1449  }
GLuint coords
Definition: glext.h:7368
ps_parser_skip_spaces(PS_Parser parser)
Definition: psobjs.c:608
Definition: import.c:86
static FT_Int ps_tocoordarray(FT_Byte **acur, FT_Byte *limit, FT_Int max_coords, FT_Short *coords)
Definition: psobjs.c:774

◆ ps_parser_to_fixed()

ps_parser_to_fixed ( PS_Parser  parser,
FT_Int  power_ten 
)

Definition at line 1433 of file psobjs.c.

1435  {
1437  return PS_Conv_ToFixed( &parser->cursor, parser->limit, power_ten );
1438  }
PS_Conv_ToFixed(FT_Byte **cursor, FT_Byte *limit, FT_Long power_ten)
Definition: psconv.c:196
ps_parser_skip_spaces(PS_Parser parser)
Definition: psobjs.c:608
Definition: import.c:86

◆ 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 1453 of file psobjs.c.

1457  {
1459  return ps_tofixedarray( &parser->cursor, parser->limit,
1460  max_values, values, power_ten );
1461  }
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
ps_parser_skip_spaces(PS_Parser parser)
Definition: psobjs.c:608
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:853
Definition: import.c:86

◆ ps_parser_to_int()

ps_parser_to_int ( PS_Parser  parser)

Definition at line 1370 of file psobjs.c.

1371  {
1373  return PS_Conv_ToInt( &parser->cursor, parser->limit );
1374  }
ps_parser_skip_spaces(PS_Parser parser)
Definition: psobjs.c:608
Definition: import.c:86
PS_Conv_ToInt(FT_Byte **cursor, FT_Byte *limit)
Definition: psconv.c:162

◆ ps_parser_to_token()

ps_parser_to_token ( PS_Parser  parser,
T1_Token  token 
)

Definition at line 618 of file psobjs.c.

620  {
621  FT_Byte* cur;
622  FT_Byte* limit;
623  FT_Int embed;
624 
625 
626  token->type = T1_TOKEN_TYPE_NONE;
627  token->start = NULL;
628  token->limit = NULL;
629 
630  /* first of all, skip leading whitespace */
632 
633  cur = parser->cursor;
634  limit = parser->limit;
635 
636  if ( cur >= limit )
637  return;
638 
639  switch ( *cur )
640  {
641  /************* check for literal string *****************/
642  case '(':
643  token->type = T1_TOKEN_TYPE_STRING;
644  token->start = cur;
645 
646  if ( skip_literal_string( &cur, limit ) == FT_Err_Ok )
647  token->limit = cur;
648  break;
649 
650  /************* check for programs/array *****************/
651  case '{':
652  token->type = T1_TOKEN_TYPE_ARRAY;
653  token->start = cur;
654 
655  if ( skip_procedure( &cur, limit ) == FT_Err_Ok )
656  token->limit = cur;
657  break;
658 
659  /************* check for table/array ********************/
660  /* XXX: in theory we should also look for "<<" */
661  /* since this is semantically equivalent to "["; */
662  /* in practice it doesn't matter (?) */
663  case '[':
664  token->type = T1_TOKEN_TYPE_ARRAY;
665  embed = 1;
666  token->start = cur++;
667 
668  /* we need this to catch `[ ]' */
669  parser->cursor = cur;
671  cur = parser->cursor;
672 
673  while ( cur < limit && !parser->error )
674  {
675  /* XXX: this is wrong because it does not */
676  /* skip comments, procedures, and strings */
677  if ( *cur == '[' )
678  embed++;
679  else if ( *cur == ']' )
680  {
681  embed--;
682  if ( embed <= 0 )
683  {
684  token->limit = ++cur;
685  break;
686  }
687  }
688 
689  parser->cursor = cur;
691  /* we need this to catch `[XXX ]' */
693  cur = parser->cursor;
694  }
695  break;
696 
697  /* ************ otherwise, it is any token **************/
698  default:
699  token->start = cur;
700  token->type = ( *cur == '/' ) ? T1_TOKEN_TYPE_KEY : T1_TOKEN_TYPE_ANY;
702  cur = parser->cursor;
703  if ( !parser->error )
704  token->limit = cur;
705  }
706 
707  if ( !token->limit )
708  {
709  token->start = NULL;
710  token->type = T1_TOKEN_TYPE_NONE;
711  }
712 
713  parser->cursor = cur;
714  }
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
ps_parser_skip_PS_token(PS_Parser parser)
Definition: psobjs.c:510
return FT_Err_Ok
Definition: ftbbox.c:511
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154
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
smooth NULL
Definition: ftsmooth.c:416
ps_parser_skip_spaces(PS_Parser parser)
Definition: psobjs.c:608
unsigned int error
Definition: inffile.c:97
static FT_Error skip_literal_string(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:335
static FT_Error skip_procedure(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:450
Definition: import.c:86

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 721 of file psobjs.c.

725  {
726  T1_TokenRec master;
727 
728 
729  *pnum_tokens = -1;
730 
731  /* this also handles leading whitespace */
732  ps_parser_to_token( parser, &master );
733 
734  if ( master.type == T1_TOKEN_TYPE_ARRAY )
735  {
736  FT_Byte* old_cursor = parser->cursor;
737  FT_Byte* old_limit = parser->limit;
738  T1_Token cur = tokens;
739  T1_Token limit = cur + max_tokens;
740 
741 
742  /* don't include outermost delimiters */
743  parser->cursor = master.start + 1;
744  parser->limit = master.limit - 1;
745 
746  while ( parser->cursor < parser->limit )
747  {
749 
750 
752  if ( !token.type )
753  break;
754 
755  if ( tokens && cur < limit )
756  *cur = token;
757 
758  cur++;
759  }
760 
761  *pnum_tokens = (FT_Int)( cur - tokens );
762 
763  parser->cursor = old_cursor;
764  parser->limit = old_limit;
765  }
766  }
signed int FT_Int
Definition: fttypes.h:220
FT_Byte * start
Definition: psaux.h:192
GLint limit
Definition: glext.h:10326
ps_parser_to_token(PS_Parser parser, T1_Token token)
Definition: psobjs.c:618
unsigned char FT_Byte
Definition: fttypes.h:154
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
T1_TokenType type
Definition: psaux.h:194
Definition: import.c:86
FT_Byte * limit
Definition: psaux.h:193

Referenced by ps_parser_load_field_table().

◆ ps_table_add()

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

Definition at line 170 of file psobjs.c.

174  {
175  if ( idx < 0 || idx >= table->max_elems )
176  {
177  FT_ERROR(( "ps_table_add: invalid index\n" ));
178  return FT_THROW( Invalid_Argument );
179  }
180 
181  /* grow the base block if needed */
182  if ( table->cursor + length > table->capacity )
183  {
184  FT_Error error;
185  FT_Offset new_size = table->capacity;
186  FT_PtrDist in_offset;
187 
188 
189  in_offset = (FT_Byte*)object - table->block;
190  if ( in_offset < 0 || (FT_Offset)in_offset >= table->capacity )
191  in_offset = -1;
192 
193  while ( new_size < table->cursor + length )
194  {
195  /* increase size by 25% and round up to the nearest multiple
196  of 1024 */
197  new_size += ( new_size >> 2 ) + 1;
198  new_size = FT_PAD_CEIL( new_size, 1024 );
199  }
200 
201  error = reallocate_t1_table( table, new_size );
202  if ( error )
203  return error;
204 
205  if ( in_offset >= 0 )
206  object = table->block + in_offset;
207  }
208 
209  /* add the object to the base block and adjust offset */
210  table->elements[idx] = table->block + table->cursor;
211  table->lengths [idx] = length;
212  FT_MEM_COPY( table->block + table->cursor, object, length );
213 
214  table->cursor += length;
215  return FT_Err_Ok;
216  }
int FT_Error
Definition: fttypes.h:300
ft_ptrdiff_t FT_PtrDist
Definition: fttypes.h:337
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
static FT_Error reallocate_t1_table(PS_Table table, FT_Offset new_size)
Definition: psobjs.c:118
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_PAD_CEIL(x, n)
Definition: ftobjs.h:90
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_THROW(e)
Definition: ftdebug.h:213
unsigned int idx
Definition: utils.c:41
if(!(yy_init))
Definition: macro.lex.yy.c:714
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
const char cursor[]
Definition: icontest.c:13
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:228
size_t FT_Offset
Definition: fttypes.h:324

◆ ps_table_done()

ps_table_done ( PS_Table  table)

Definition at line 236 of file psobjs.c.

237  {
238  FT_Memory memory = table->memory;
239  FT_Error error;
240  FT_Byte* old_base = table->block;
241 
242 
243  /* should never fail, because rec.cursor <= rec.size */
244  if ( !old_base )
245  return;
246 
247  if ( FT_ALLOC( table->block, table->cursor ) )
248  return;
249  FT_MEM_COPY( table->block, old_base, table->cursor );
250  shift_elements( table, old_base );
251 
252  table->capacity = table->cursor;
253  FT_FREE( old_base );
254 
255  FT_UNUSED( error );
256  }
static void shift_elements(PS_Table table, FT_Byte *old_base)
Definition: psobjs.c:101
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:228
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ ps_table_new()

ps_table_new ( PS_Table  table,
FT_Int  count,
FT_Memory  memory 
)

Definition at line 71 of file psobjs.c.

74  {
76 
77 
78  table->memory = memory;
79  if ( FT_NEW_ARRAY( table->elements, count ) ||
80  FT_NEW_ARRAY( table->lengths, count ) )
81  goto Exit;
82 
83  table->max_elems = count;
84  table->init = 0xDEADBEEFUL;
85  table->num_elems = 0;
86  table->block = NULL;
87  table->capacity = 0;
88  table->cursor = 0;
89 
91 
92  Exit:
93  if ( error )
94  FT_FREE( table->elements );
95 
96  return error;
97  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei count
Definition: gl.h:1545
static char memory[1024 *256]
Definition: process.c:116
smooth NULL
Definition: ftsmooth.c:416
#define FT_FREE(ptr)
Definition: ftmemory.h:329
if(!(yy_init))
Definition: macro.lex.yy.c:714
static void Exit(void)
Definition: sock.c:1331
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:333
#define UL
Definition: tui.h:83
FT_CALLBACK_TABLE_DEF const PS_Table_FuncsRec ps_table_funcs
Definition: psauxmod.c:33

◆ ps_table_release()

ps_table_release ( PS_Table  table)

Definition at line 260 of file psobjs.c.

261  {
262  FT_Memory memory = table->memory;
263 
264 
265  if ( (FT_ULong)table->init == 0xDEADBEEFUL )
266  {
267  FT_FREE( table->block );
268  FT_FREE( table->elements );
269  FT_FREE( table->lengths );
270  table->init = 0;
271  }
272  }
unsigned long FT_ULong
Definition: fttypes.h:253
static char memory[1024 *256]
Definition: process.c:116
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66

◆ ps_tobool()

static int ps_tobool ( FT_Byte **  acur,
FT_Byte limit 
)
static

Definition at line 989 of file psobjs.c.

991  {
992  FT_Byte* cur = *acur;
993  FT_Bool result = 0;
994 
995 
996  /* return 1 if we find `true', 0 otherwise */
997  if ( cur + 3 < limit &&
998  cur[0] == 't' &&
999  cur[1] == 'r' &&
1000  cur[2] == 'u' &&
1001  cur[3] == 'e' )
1002  {
1003  result = 1;
1004  cur += 5;
1005  }
1006  else if ( cur + 4 < limit &&
1007  cur[0] == 'f' &&
1008  cur[1] == 'a' &&
1009  cur[2] == 'l' &&
1010  cur[3] == 's' &&
1011  cur[4] == 'e' )
1012  {
1013  result = 0;
1014  cur += 6;
1015  }
1016 
1017  *acur = cur;
1018  return result;
1019  }
GLint limit
Definition: glext.h:10326
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned char FT_Byte
Definition: fttypes.h:154
GLuint64EXT * result
Definition: glext.h:11304

Referenced by ps_parser_load_field().

◆ ps_tocoordarray()

static FT_Int ps_tocoordarray ( FT_Byte **  acur,
FT_Byte limit,
FT_Int  max_coords,
FT_Short coords 
)
static

Definition at line 774 of file psobjs.c.

778  {
779  FT_Byte* cur = *acur;
780  FT_Int count = 0;
781  FT_Byte c, ender;
782 
783 
784  if ( cur >= limit )
785  goto Exit;
786 
787  /* check for the beginning of an array; otherwise, only one number */
788  /* will be read */
789  c = *cur;
790  ender = 0;
791 
792  if ( c == '[' )
793  ender = ']';
794  else if ( c == '{' )
795  ender = '}';
796 
797  if ( ender )
798  cur++;
799 
800  /* now, read the coordinates */
801  while ( cur < limit )
802  {
803  FT_Short dummy;
804  FT_Byte* old_cur;
805 
806 
807  /* skip whitespace in front of data */
808  skip_spaces( &cur, limit );
809  if ( cur >= limit )
810  goto Exit;
811 
812  if ( *cur == ender )
813  {
814  cur++;
815  break;
816  }
817 
818  old_cur = cur;
819 
820  if ( coords && count >= max_coords )
821  break;
822 
823  /* call PS_Conv_ToFixed() even if coords == NULL */
824  /* to properly parse number at `cur' */
825  *( coords ? &coords[count] : &dummy ) =
826  (FT_Short)( PS_Conv_ToFixed( &cur, limit, 0 ) >> 16 );
827 
828  if ( old_cur == cur )
829  {
830  count = -1;
831  goto Exit;
832  }
833  else
834  count++;
835 
836  if ( !ender )
837  break;
838  }
839 
840  Exit:
841  *acur = cur;
842  return count;
843  }
PS_Conv_ToFixed(FT_Byte **cursor, FT_Byte *limit, FT_Long power_ten)
Definition: psconv.c:196
signed int FT_Int
Definition: fttypes.h:220
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint coords
Definition: glext.h:7368
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154
static void Exit(void)
Definition: sock.c:1331
static void skip_spaces(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:305
const GLubyte * c
Definition: glext.h:8905
signed short FT_Short
Definition: fttypes.h:198
unsigned char dummy
Definition: maze.c:118
#define c
Definition: ke_i.h:80

Referenced by ps_parser_to_coord_array().

◆ ps_tofixedarray()

static FT_Int ps_tofixedarray ( FT_Byte **  acur,
FT_Byte limit,
FT_Int  max_values,
FT_Fixed values,
FT_Int  power_ten 
)
static

Definition at line 853 of file psobjs.c.

858  {
859  FT_Byte* cur = *acur;
860  FT_Int count = 0;
861  FT_Byte c, ender;
862 
863 
864  if ( cur >= limit )
865  goto Exit;
866 
867  /* Check for the beginning of an array. Otherwise, only one number */
868  /* will be read. */
869  c = *cur;
870  ender = 0;
871 
872  if ( c == '[' )
873  ender = ']';
874  else if ( c == '{' )
875  ender = '}';
876 
877  if ( ender )
878  cur++;
879 
880  /* now, read the values */
881  while ( cur < limit )
882  {
883  FT_Fixed dummy;
884  FT_Byte* old_cur;
885 
886 
887  /* skip whitespace in front of data */
888  skip_spaces( &cur, limit );
889  if ( cur >= limit )
890  goto Exit;
891 
892  if ( *cur == ender )
893  {
894  cur++;
895  break;
896  }
897 
898  old_cur = cur;
899 
900  if ( values && count >= max_values )
901  break;
902 
903  /* call PS_Conv_ToFixed() even if coords == NULL */
904  /* to properly parse number at `cur' */
905  *( values ? &values[count] : &dummy ) =
906  PS_Conv_ToFixed( &cur, limit, power_ten );
907 
908  if ( old_cur == cur )
909  {
910  count = -1;
911  goto Exit;
912  }
913  else
914  count++;
915 
916  if ( !ender )
917  break;
918  }
919 
920  Exit:
921  *acur = cur;
922  return count;
923  }
PS_Conv_ToFixed(FT_Byte **cursor, FT_Byte *limit, FT_Long power_ten)
Definition: psconv.c:196
signed int FT_Int
Definition: fttypes.h:220
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154
static void Exit(void)
Definition: sock.c:1331
static void skip_spaces(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:305
const GLubyte * c
Definition: glext.h:8905
signed long FT_Fixed
Definition: fttypes.h:288
unsigned char dummy
Definition: maze.c:118
#define c
Definition: ke_i.h:80

Referenced by ps_parser_load_field(), and ps_parser_to_fixed_array().

◆ reallocate_t1_table()

static FT_Error reallocate_t1_table ( PS_Table  table,
FT_Offset  new_size 
)
static

Definition at line 118 of file psobjs.c.

120  {
121  FT_Memory memory = table->memory;
122  FT_Byte* old_base = table->block;
123  FT_Error error;
124 
125 
126  /* allocate new base block */
127  if ( FT_ALLOC( table->block, new_size ) )
128  {
129  table->block = old_base;
130  return error;
131  }
132 
133  /* copy elements and shift offsets */
134  if ( old_base )
135  {
136  FT_MEM_COPY( table->block, old_base, table->capacity );
137  shift_elements( table, old_base );
138  FT_FREE( old_base );
139  }
140 
141  table->capacity = new_size;
142 
143  return FT_Err_Ok;
144  }
static void shift_elements(PS_Table table, FT_Byte *old_base)
Definition: psobjs.c:101
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:228

Referenced by ps_table_add().

◆ shift_elements()

static void shift_elements ( PS_Table  table,
FT_Byte old_base 
)
static

Definition at line 101 of file psobjs.c.

103  {
104  FT_PtrDist delta = table->block - old_base;
105  FT_Byte** offset = table->elements;
106  FT_Byte** limit = offset + table->max_elems;
107 
108 
109  for ( ; offset < limit; offset++ )
110  {
111  if ( offset[0] )
112  offset[0] += delta;
113  }
114  }
ft_ptrdiff_t FT_PtrDist
Definition: fttypes.h:337
GLintptr offset
Definition: glext.h:5920
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154

Referenced by ps_table_done(), and reallocate_t1_table().

◆ skip_comment()

static void skip_comment ( FT_Byte **  acur,
FT_Byte limit 
)
static

Definition at line 287 of file psobjs.c.

289  {
290  FT_Byte* cur = *acur;
291 
292 
293  while ( cur < limit )
294  {
295  if ( IS_PS_NEWLINE( *cur ) )
296  break;
297  cur++;
298  }
299 
300  *acur = cur;
301  }
#define IS_PS_NEWLINE(ch)
Definition: psaux.h:1325
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154

Referenced by skip_spaces().

◆ skip_literal_string()

static FT_Error skip_literal_string ( FT_Byte **  acur,
FT_Byte limit 
)
static

Definition at line 335 of file psobjs.c.

337  {
338  FT_Byte* cur = *acur;
339  FT_Int embed = 0;
340  FT_Error error = FT_ERR( Invalid_File_Format );
341  unsigned int i;
342 
343 
344  while ( cur < limit )
345  {
346  FT_Byte c = *cur;
347 
348 
349  cur++;
350 
351  if ( c == '\\' )
352  {
353  /* Red Book 3rd ed., section `Literal Text Strings', p. 29: */
354  /* A backslash can introduce three different types */
355  /* of escape sequences: */
356  /* - a special escaped char like \r, \n, etc. */
357  /* - a one-, two-, or three-digit octal number */
358  /* - none of the above in which case the backslash is ignored */
359 
360  if ( cur == limit )
361  /* error (or to be ignored?) */
362  break;
363 
364  switch ( *cur )
365  {
366  /* skip `special' escape */
367  case 'n':
368  case 'r':
369  case 't':
370  case 'b':
371  case 'f':
372  case '\\':
373  case '(':
374  case ')':
375  cur++;
376  break;
377 
378  default:
379  /* skip octal escape or ignore backslash */
380  for ( i = 0; i < 3 && cur < limit; i++ )
381  {
382  if ( !IS_OCTAL_DIGIT( *cur ) )
383  break;
384 
385  cur++;
386  }
387  }
388  }
389  else if ( c == '(' )
390  embed++;
391  else if ( c == ')' )
392  {
393  embed--;
394  if ( embed == 0 )
395  {
396  error = FT_Err_Ok;
397  break;
398  }
399  }
400  }
401 
402  *acur = cur;
403 
404  return error;
405  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
return FT_Err_Ok
Definition: ftbbox.c:511
GLint limit
Definition: glext.h:10326
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
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_ERR(e)
Definition: fttypes.h:586
#define IS_OCTAL_DIGIT(c)
Definition: psobjs.c:328
const GLubyte * c
Definition: glext.h:8905

Referenced by ps_parser_to_token().

◆ skip_procedure()

static FT_Error skip_procedure ( FT_Byte **  acur,
FT_Byte limit 
)
static

Definition at line 450 of file psobjs.c.

452  {
453  FT_Byte* cur;
454  FT_Int embed = 0;
456 
457 
458  FT_ASSERT( **acur == '{' );
459 
460  for ( cur = *acur; cur < limit && error == FT_Err_Ok; cur++ )
461  {
462  switch ( *cur )
463  {
464  case '{':
465  embed++;
466  break;
467 
468  case '}':
469  embed--;
470  if ( embed == 0 )
471  {
472  cur++;
473  goto end;
474  }
475  break;
476 
477  case '(':
478  error = skip_literal_string( &cur, limit );
479  break;
480 
481  case '<':
482  error = skip_string( &cur, limit );
483  break;
484 
485  case '%':
486  skip_comment( &cur, limit );
487  break;
488  }
489  }
490 
491  end:
492  if ( embed != 0 )
493  error = FT_THROW( Invalid_File_Format );
494 
495  *acur = cur;
496 
497  return error;
498  }
int FT_Error
Definition: fttypes.h:300
static FT_Error skip_string(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:411
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
GLuint GLuint end
Definition: gl.h:1545
return FT_Err_Ok
Definition: ftbbox.c:511
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
static FT_Error skip_literal_string(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:335
static void skip_comment(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:287

Referenced by ps_parser_to_token().

◆ skip_spaces()

static void skip_spaces ( FT_Byte **  acur,
FT_Byte limit 
)
static

Definition at line 305 of file psobjs.c.

307  {
308  FT_Byte* cur = *acur;
309 
310 
311  while ( cur < limit )
312  {
313  if ( !IS_PS_SPACE( *cur ) )
314  {
315  if ( *cur == '%' )
316  /* According to the PLRM, a comment is equal to a space. */
317  skip_comment( &cur, limit );
318  else
319  break;
320  }
321  cur++;
322  }
323 
324  *acur = cur;
325  }
#define IS_PS_SPACE(ch)
Definition: psaux.h:1329
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154
static void skip_comment(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:287

Referenced by ps_parser_load_field(), ps_parser_skip_spaces(), ps_tocoordarray(), ps_tofixedarray(), and skip_string().

◆ skip_string()

static FT_Error skip_string ( FT_Byte **  acur,
FT_Byte limit 
)
static

Definition at line 411 of file psobjs.c.

413  {
414  FT_Byte* cur = *acur;
416 
417 
418  while ( ++cur < limit )
419  {
420  /* All whitespace characters are ignored. */
421  skip_spaces( &cur, limit );
422  if ( cur >= limit )
423  break;
424 
425  if ( !IS_PS_XDIGIT( *cur ) )
426  break;
427  }
428 
429  if ( cur < limit && *cur != '>' )
430  {
431  FT_ERROR(( "skip_string: missing closing delimiter `>'\n" ));
432  err = FT_THROW( Invalid_File_Format );
433  }
434  else
435  cur++;
436 
437  *acur = cur;
438  return err;
439  }
int FT_Error
Definition: fttypes.h:300
GLdouble n
Definition: glext.h:7729
return FT_Err_Ok
Definition: ftbbox.c:511
GLint limit
Definition: glext.h:10326
unsigned char FT_Byte
Definition: fttypes.h:154
static void skip_spaces(FT_Byte **acur, FT_Byte *limit)
Definition: psobjs.c:305
#define err(...)
#define IS_PS_XDIGIT(ch)
Definition: psaux.h:1351

◆ t1_builder_add_contour()

t1_builder_add_contour ( T1_Builder  builder)

Definition at line 1651 of file psobjs.c.

1652  {
1653  FT_Outline* outline = builder->current;
1654  FT_Error error;
1655 
1656 
1657  /* this might happen in invalid fonts */
1658  if ( !outline )
1659  {
1660  FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" ));
1661  return FT_THROW( Invalid_File_Format );
1662  }
1663 
1664  if ( !builder->load_points )
1665  {
1666  outline->n_contours++;
1667  return FT_Err_Ok;
1668  }
1669 
1670  error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
1671  if ( !error )
1672  {
1673  if ( outline->n_contours > 0 )
1674  outline->contours[outline->n_contours - 1] =
1675  (short)( outline->n_points - 1 );
1676 
1677  outline->n_contours++;
1678  }
1679 
1680  return error;
1681  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
FT_Outline * current
Definition: psaux.h:787
Definition: mesh.c:5329
FT_GlyphLoader loader
Definition: psaux.h:785
FT_Bool load_points
Definition: psaux.h:797
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
Definition: ftgloadr.h:118

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 1610 of file psobjs.c.

1614  {
1615  FT_Outline* outline = builder->current;
1616 
1617 
1618  if ( builder->load_points )
1619  {
1620  FT_Vector* point = outline->points + outline->n_points;
1621  FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
1622 
1623 
1624  point->x = FIXED_TO_INT( x );
1625  point->y = FIXED_TO_INT( y );
1626  *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
1627  }
1628  outline->n_points++;
1629  }
#define FIXED_TO_INT(x)
Definition: ftcalc.h:406
#define FT_CURVE_TAG_CUBIC
Definition: ftimage.h:455
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL point
Definition: edittest.c:50
LONG y
Definition: windef.h:315
unsigned char FT_Byte
Definition: fttypes.h:154
LONG x
Definition: windef.h:314
FT_Outline * current
Definition: psaux.h:787
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
Definition: mesh.c:5329
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
FT_Bool load_points
Definition: psaux.h:797
#define FT_CURVE_TAG_ON
Definition: ftimage.h:453

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 1634 of file psobjs.c.

1637  {
1638  FT_Error error;
1639 
1640 
1641  error = t1_builder_check_points( builder, 1 );
1642  if ( !error )
1643  t1_builder_add_point( builder, x, y, 1 );
1644 
1645  return error;
1646  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
t1_builder_add_point(T1_Builder builder, FT_Pos x, FT_Pos y, FT_Byte flag)
Definition: psobjs.c:1610
t1_builder_check_points(T1_Builder builder, FT_Int count)
Definition: psobjs.c:1601

Referenced by t1_builder_start_point().

◆ t1_builder_check_points()

t1_builder_check_points ( T1_Builder  builder,
FT_Int  count 
)

Definition at line 1601 of file psobjs.c.

1603  {
1604  return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
1605  }
GLuint GLuint GLsizei count
Definition: gl.h:1545
FT_GlyphLoader loader
Definition: psaux.h:785
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
Definition: ftgloadr.h:118

Referenced by t1_builder_add_point1().

◆ t1_builder_close_contour()

t1_builder_close_contour ( T1_Builder  builder)

Definition at line 1711 of file psobjs.c.

1712  {
1713  FT_Outline* outline = builder->current;
1714  FT_Int first;
1715 
1716 
1717  if ( !outline )
1718  return;
1719 
1720  first = outline->n_contours <= 1
1721  ? 0 : outline->contours[outline->n_contours - 2] + 1;
1722 
1723  /* in malformed fonts it can happen that a contour was started */
1724  /* but no points were added */
1725  if ( outline->n_contours && first == outline->n_points )
1726  {
1727  outline->n_contours--;
1728  return;
1729  }
1730 
1731  /* We must not include the last point in the path if it */
1732  /* is located on the first point. */
1733  if ( outline->n_points > 1 )
1734  {
1735  FT_Vector* p1 = outline->points + first;
1736  FT_Vector* p2 = outline->points + outline->n_points - 1;
1737  FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
1738 
1739 
1740  /* `delete' last point only if it coincides with the first */
1741  /* point and it is not a control point (which can happen). */
1742  if ( p1->x == p2->x && p1->y == p2->y )
1743  if ( *control == FT_CURVE_TAG_ON )
1744  outline->n_points--;
1745  }
1746 
1747  if ( outline->n_contours > 0 )
1748  {
1749  /* Don't add contours only consisting of one point, i.e., */
1750  /* check whether the first and the last point is the same. */
1751  if ( first == outline->n_points - 1 )
1752  {
1753  outline->n_contours--;
1754  outline->n_points--;
1755  }
1756  else
1757  outline->contours[outline->n_contours - 1] =
1758  (short)( outline->n_points - 1 );
1759  }
1760  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
signed int FT_Int
Definition: fttypes.h:220
const GLint * first
Definition: glext.h:5794
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned char FT_Byte
Definition: fttypes.h:154
if(!(yy_init))
Definition: macro.lex.yy.c:714
FT_Outline * current
Definition: psaux.h:787
Definition: mesh.c:5329
#define FT_CURVE_TAG_ON
Definition: ftimage.h:453

◆ t1_builder_done()

t1_builder_done ( T1_Builder  builder)

Definition at line 1589 of file psobjs.c.

1590  {
1591  FT_GlyphSlot glyph = builder->glyph;
1592 
1593 
1594  if ( glyph )
1595  glyph->outline = *builder->base;
1596  }
FT_Outline * base
Definition: psaux.h:786
FT_GlyphSlot glyph
Definition: psaux.h:784
FT_Outline outline
Definition: freetype.h:1927

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 1533 of file psobjs.c.

1538  {
1539  builder->parse_state = T1_Parse_Start;
1540  builder->load_points = 1;
1541 
1542  builder->face = face;
1543  builder->glyph = glyph;
1544  builder->memory = face->memory;
1545 
1546  if ( glyph )
1547  {
1548  FT_GlyphLoader loader = glyph->internal->loader;
1549 
1550 
1551  builder->loader = loader;
1552  builder->base = &loader->base.outline;
1553  builder->current = &loader->current.outline;
1554  FT_GlyphLoader_Rewind( loader );
1555 
1556  builder->hints_globals = size->internal->module_data;
1557  builder->hints_funcs = NULL;
1558 
1559  if ( hinting )
1560  builder->hints_funcs = glyph->internal->glyph_hints;
1561  }
1562 
1563  builder->pos_x = 0;
1564  builder->pos_y = 0;
1565 
1566  builder->left_bearing.x = 0;
1567  builder->left_bearing.y = 0;
1568  builder->advance.x = 0;
1569  builder->advance.y = 0;
1570 
1571  builder->funcs = t1_builder_funcs;
1572  }
FT_Pos y
Definition: ftimage.h:77
FT_Vector advance
Definition: psaux.h:793
FT_Outline * base
Definition: psaux.h:786
FT_Pos x
Definition: ftimage.h:76
FT_GlyphSlot glyph
Definition: psaux.h:784
WORD face[3]
Definition: mesh.c:4747
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
FT_CALLBACK_TABLE_DEF const T1_Builder_FuncsRec t1_builder_funcs
Definition: psauxmod.c:73
FT_Outline outline
Definition: ftgloadr.h:52
FT_GlyphLoader loader
Definition: ftobjs.h:467
smooth NULL
Definition: ftsmooth.c:416
T1_ParseState parse_state
Definition: psaux.h:796
GLsizeiptr size
Definition: glext.h:5919
FT_Face face
Definition: psaux.h:783
FT_Memory memory
Definition: psaux.h:782
FT_Pos pos_x
Definition: psaux.h:789
FT_Vector left_bearing
Definition: psaux.h:792
FT_Outline * current
Definition: psaux.h:787
FT_GlyphLoadRec current
Definition: ftgloadr.h:70
T1_Builder_FuncsRec funcs
Definition: psaux.h:805
void * hints_funcs
Definition: psaux.h:802
FT_GlyphLoader loader
Definition: psaux.h:785
FT_GlyphLoader_Rewind(FT_GlyphLoader loader)
Definition: ftgloadr.c:88
FT_Bool load_points
Definition: psaux.h:797
void * hints_globals
Definition: psaux.h:803
FT_Slot_Internal internal
Definition: freetype.h:1940
FT_Pos pos_y
Definition: psaux.h:790
void * glyph_hints
Definition: ftobjs.h:472
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

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 1686 of file psobjs.c.

1689  {
1690  FT_Error error = FT_ERR( Invalid_File_Format );
1691 
1692 
1693  /* test whether we are building a new contour */
1694 
1695  if ( builder->parse_state == T1_Parse_Have_Path )
1696  error = FT_Err_Ok;
1697  else
1698  {
1699  builder->parse_state = T1_Parse_Have_Path;
1700  error = t1_builder_add_contour( builder );
1701  if ( !error )
1702  error = t1_builder_add_point1( builder, x, y );
1703  }
1704 
1705  return error;
1706  }
int FT_Error
Definition: fttypes.h:300
t1_builder_add_point1(T1_Builder builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:1634
#define error(str)
Definition: mkdosfs.c:1605
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
return FT_Err_Ok
Definition: ftbbox.c:511
T1_ParseState parse_state
Definition: psaux.h:796
#define FT_ERR(e)
Definition: fttypes.h:586
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
t1_builder_add_contour(T1_Builder builder)
Definition: psobjs.c:1651

◆ t1_decrypt()

t1_decrypt ( FT_Byte buffer,
FT_Offset  length,
FT_UShort  seed 
)

Definition at line 2509 of file psobjs.c.

2512  {
2514  buffer + length,
2515  buffer,
2516  length,
2517  &seed );
2518  }
PS_Conv_EexecDecode(FT_Byte **cursor, FT_Byte *limit, FT_Byte *buffer, FT_Offset n, FT_UShort *seed)
Definition: psconv.c:558
GLuint buffer
Definition: glext.h:5915
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579

◆ t1_make_subfont()

t1_make_subfont ( FT_Face  face,
PS_Private  priv,
CFF_SubFont  subfont 
)

Definition at line 2424 of file psobjs.c.

2427  {
2428  CFF_Private cpriv = &subfont->private_dict;
2429  FT_UInt n, count;
2430 
2431 
2432  FT_ZERO( subfont );
2433  FT_ZERO( cpriv );
2434 
2435  count = cpriv->num_blue_values = priv->num_blue_values;
2436  for ( n = 0; n < count; n++ )
2437  cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
2438 
2439  count = cpriv->num_other_blues = priv->num_other_blues;
2440  for ( n = 0; n < count; n++ )
2441  cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
2442 
2443  count = cpriv->num_family_blues = priv->num_family_blues;
2444  for ( n = 0; n < count; n++ )
2445  cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
2446 
2448  for ( n = 0; n < count; n++ )
2449  cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n];
2450 
2451  cpriv->blue_scale = priv->blue_scale;
2452  cpriv->blue_shift = (FT_Pos)priv->blue_shift;
2453  cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz;
2454 
2455  cpriv->standard_width = (FT_Pos)priv->standard_width[0];
2456  cpriv->standard_height = (FT_Pos)priv->standard_height[0];
2457 
2458  count = cpriv->num_snap_widths = priv->num_snap_widths;
2459  for ( n = 0; n < count; n++ )
2460  cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n];
2461 
2462  count = cpriv->num_snap_heights = priv->num_snap_heights;
2463  for ( n = 0; n < count; n++ )
2464  cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n];
2465 
2466  cpriv->force_bold = priv->force_bold;
2467  cpriv->lenIV = priv->lenIV;
2468  cpriv->language_group = priv->language_group;
2469  cpriv->expansion_factor = priv->expansion_factor;
2470 
2471  cpriv->subfont = subfont;
2472 
2473 
2474  /* Initialize the random number generator. */
2475  if ( face->internal->random_seed != -1 )
2476  {
2477  /* If we have a face-specific seed, use it. */
2478  /* If non-zero, update it to a positive value. */
2479  subfont->random = (FT_UInt32)face->internal->random_seed;
2480  if ( face->internal->random_seed )
2481  {
2482  do
2483  {
2484  face->internal->random_seed = (FT_Int32)cff_random(
2485  (FT_UInt32)face->internal->random_seed );
2486 
2487  } while ( face->internal->random_seed < 0 );
2488  }
2489  }
2490  if ( !subfont->random )
2491  {
2492  FT_UInt32 seed;
2493 
2494 
2495  /* compute random seed from some memory addresses */
2496  seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
2497  (FT_Offset)(char*)&face ^
2498  (FT_Offset)(char*)&subfont );
2499  seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
2500  if ( seed == 0 )
2501  seed = 0x7384;
2502 
2503  subfont->random = seed;
2504  }
2505  }
FT_Byte num_family_blues
Definition: cfftypes.h:244
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
FT_Long language_group
Definition: t1tables.h:171
FT_Pos blue_values[14]
Definition: cfftypes.h:247
FT_Pos other_blues[10]
Definition: cfftypes.h:248
FT_Byte num_snap_heights
Definition: cfftypes.h:259
GLuint GLuint GLsizei count
Definition: gl.h:1545
FT_Byte num_family_other_blues
Definition: t1tables.h:146
GLdouble n
Definition: glext.h:7729
FT_Int blue_fuzz
Definition: t1tables.h:156
FT_Pos blue_shift
Definition: cfftypes.h:253
FT_Byte num_blue_values
Definition: t1tables.h:143
FT_Pos snap_widths[13]
Definition: cfftypes.h:260
FT_Fixed expansion_factor
Definition: t1tables.h:169
FT_Int lenIV
Definition: t1tables.h:141
FT_Fixed blue_scale
Definition: cfftypes.h:252
FT_Pos blue_fuzz
Definition: cfftypes.h:254
cff_random(FT_UInt32 r)
Definition: psobjs.c:2522
FT_Pos family_blues[14]
Definition: cfftypes.h:249
FT_Byte num_other_blues
Definition: t1tables.h:144
FT_Pos standard_width
Definition: cfftypes.h:255
FT_Int lenIV
Definition: cfftypes.h:264
FT_Short blue_values[14]
Definition: t1tables.h:148
FT_Pos snap_heights[13]
Definition: cfftypes.h:261
FT_Fixed blue_scale
Definition: t1tables.h:154
FT_Byte num_family_other_blues
Definition: cfftypes.h:245
FT_Bool force_bold
Definition: cfftypes.h:262
FT_Int language_group
Definition: cfftypes.h:265
FT_Short other_blues[10]
Definition: t1tables.h:149
FT_UShort standard_height[1]
Definition: t1tables.h:159
CFF_PrivateRec private_dict
Definition: cfftypes.h:301
FT_Short snap_widths[13]
Definition: t1tables.h:166
FT_UInt32 random
Definition: cfftypes.h:325
FT_UShort standard_width[1]
Definition: t1tables.h:158
#define FT_ZERO(p)
Definition: ftmemory.h:237
if(!(yy_init))
Definition: macro.lex.yy.c:714
FT_Fixed expansion_factor
Definition: cfftypes.h:266
FT_Byte num_snap_widths
Definition: cfftypes.h:258
FT_Byte num_other_blues
Definition: cfftypes.h:243
FT_Byte num_family_blues
Definition: t1tables.h:145
FT_Short family_other_blues[10]
Definition: t1tables.h:152
FT_Pos standard_height
Definition: cfftypes.h:256
FT_Byte num_snap_widths
Definition: t1tables.h:161
unsigned int FT_UInt
Definition: fttypes.h:231
FT_Byte num_snap_heights
Definition: t1tables.h:162
FT_Int blue_shift
Definition: t1tables.h:155
FT_Short snap_heights[13]
Definition: t1tables.h:167
FT_Pos family_other_blues[10]
Definition: cfftypes.h:250
FT_Bool force_bold
Definition: t1tables.h:163
FT_Short family_blues[14]
Definition: t1tables.h:151
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
FT_Byte num_blue_values
Definition: cfftypes.h:242
size_t FT_Offset
Definition: fttypes.h:324
CFF_SubFont subfont
Definition: cfftypes.h:274