ReactOS 0.4.16-dev-1067-ge98bba2
ttobjs.c File Reference
#include <ft2build.h>
#include "ttgload.h"
#include "ttpload.h"
#include "tterrors.h"
Include dependency graph for ttobjs.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tt_sfnt_id_rec_
 

Macros

#define FT_COMPONENT   ttobjs
 
#define TRICK_NAMES_MAX_CHARACTERS   19
 
#define TRICK_NAMES_COUNT   26
 
#define TRICK_SFNT_IDS_PER_FACE   3
 
#define TRICK_SFNT_IDS_NUM_FACES   29
 
#define TRICK_SFNT_ID_cvt   0
 
#define TRICK_SFNT_ID_fpgm   1
 
#define TRICK_SFNT_ID_prep   2
 

Typedefs

typedef struct tt_sfnt_id_rec_ tt_sfnt_id_rec
 

Functions

static FT_Bool tt_check_trickyness_family (FT_String *name)
 
static FT_UInt32 tt_synth_sfnt_checksum (FT_Stream stream, FT_ULong length)
 
static FT_ULong tt_get_sfnt_checksum (TT_Face face, FT_UShort i)
 
static FT_Bool tt_check_trickyness_sfnt_ids (TT_Face face)
 
static FT_Bool tt_check_trickyness (FT_Face face)
 
static FT_Bool tt_check_single_notdef (FT_Face ttface)
 
 tt_face_init (FT_Stream stream, FT_Face ttface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
 
 tt_face_done (FT_Face ttface)
 
 tt_size_init (FT_Size ttsize)
 
 tt_size_done (FT_Size ttsize)
 
 tt_size_reset (TT_Size size, FT_Bool only_height)
 
 tt_driver_init (FT_Module ttdriver)
 
 tt_driver_done (FT_Module ttdriver)
 
 tt_slot_init (FT_GlyphSlot slot)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   ttobjs

Definition at line 46 of file ttobjs.c.

◆ TRICK_NAMES_COUNT

#define TRICK_NAMES_COUNT   26

◆ TRICK_NAMES_MAX_CHARACTERS

#define TRICK_NAMES_MAX_CHARACTERS   19

◆ TRICK_SFNT_ID_cvt

#define TRICK_SFNT_ID_cvt   0

◆ TRICK_SFNT_ID_fpgm

#define TRICK_SFNT_ID_fpgm   1

◆ TRICK_SFNT_ID_prep

#define TRICK_SFNT_ID_prep   2

◆ TRICK_SFNT_IDS_NUM_FACES

#define TRICK_SFNT_IDS_NUM_FACES   29

◆ TRICK_SFNT_IDS_PER_FACE

#define TRICK_SFNT_IDS_PER_FACE   3

Typedef Documentation

◆ tt_sfnt_id_rec

Function Documentation

◆ tt_check_single_notdef()

static FT_Bool tt_check_single_notdef ( FT_Face  ttface)
static

Definition at line 528 of file ttobjs.c.

529 {
531
532 TT_Face face = (TT_Face)ttface;
533 FT_UInt asize;
534 FT_ULong i;
535 FT_ULong glyph_index = 0;
536 FT_UInt count = 0;
537
538
539 for( i = 0; i < face->num_locations; i++ )
540 {
541 tt_face_get_location( face, i, &asize );
542 if ( asize > 0 )
543 {
544 count += 1;
545 if ( count > 1 )
546 break;
547 glyph_index = i;
548 }
549 }
550
551 /* Only have a single outline. */
552 if ( count == 1 )
553 {
554 if ( glyph_index == 0 )
555 result = TRUE;
556 else
557 {
558 /* FIXME: Need to test glyphname == .notdef ? */
560 char buf[8];
561
562
563 error = FT_Get_Glyph_Name( ttface, glyph_index, buf, 8 );
564 if ( !error &&
565 buf[0] == '.' && !ft_strncmp( buf, ".notdef", 8 ) )
566 result = TRUE;
567 }
568 }
569
570 return result;
571 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
FT_Get_Glyph_Name(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
Definition: ftobjs.c:4090
#define ft_strncmp
Definition: ftstdlib.h:89
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:299
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint64EXT * result
Definition: glext.h:11304
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
#define error(str)
Definition: mkdosfs.c:1605
tt_face_get_location(TT_Face face, FT_UInt gindex, FT_UInt *asize)
Definition: ttpload.c:197
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:1064

Referenced by tt_face_init().

◆ tt_check_trickyness()

static FT_Bool tt_check_trickyness ( FT_Face  face)
static

Definition at line 506 of file ttobjs.c.

507 {
508 if ( !face )
509 return FALSE;
510
511 /* For first, check the face name for quick check. */
512 if ( face->family_name &&
513 tt_check_trickyness_family( face->family_name ) )
514 return TRUE;
515
516 /* Type42 fonts may lack `name' tables, we thus try to identify */
517 /* tricky fonts by checking the checksums of Type42-persistent */
518 /* sfnt tables (`cvt', `fpgm', and `prep'). */
520 return TRUE;
521
522 return FALSE;
523 }
static FT_Bool tt_check_trickyness_family(FT_String *name)
Definition: ttobjs.c:151
static FT_Bool tt_check_trickyness_sfnt_ids(TT_Face face)
Definition: ttobjs.c:278

Referenced by tt_face_init().

◆ tt_check_trickyness_family()

static FT_Bool tt_check_trickyness_family ( FT_String name)
static

Definition at line 151 of file ttobjs.c.

152 {
153
154#define TRICK_NAMES_MAX_CHARACTERS 19
155#define TRICK_NAMES_COUNT 26
156
157 static const char trick_names[TRICK_NAMES_COUNT]
159 {
160 /*
161 PostScript names are given in brackets if they differ from the
162 family name. The version numbers, together with the copyright or
163 release year data, are taken from fonts available to the
164 developers.
165
166 Note that later versions of the fonts might be no longer tricky;
167 for example, `MingLiU' version 7.00 (file `mingliu.ttc' from
168 Windows 7) is an ordinary TTC with non-tricky subfonts.
169 */
170
171 "cpop", /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */
172 "DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */
173 "DFGothic-EB", /* DynaLab Inc. 1992-1995 */
174 "DFGyoSho-Lt", /* DynaLab Inc. 1992-1995 */
175 "DFHei-Md-HK-BF", /* maybe DynaLab Inc. */
176 "DFHSGothic-W5", /* DynaLab Inc. 1992-1995 */
177 "DFHSMincho-W3", /* DynaLab Inc. 1992-1995 */
178 "DFHSMincho-W7", /* DynaLab Inc. 1992-1995 */
179 "DFKaiSho-SB", /* dfkaisb.ttf */
180 "DFKaiShu",
181 "DFKaiShu-Md-HK-BF", /* maybe DynaLab Inc. */
182 "DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */
183 "DFMing-Bd-HK-BF", /* maybe DynaLab Inc. */
184 "DLC", /* dftt-m7.ttf; version 1.00, 1993 [DLCMingBold] */
185 /* dftt-f5.ttf; version 1.00, 1993 [DLCFongSung] */
186 "DLCHayMedium", /* dftt-b5.ttf; version 1.00, 1993 */
187 "DLCHayBold", /* dftt-b7.ttf; version 1.00, 1993 */
188 "DLCKaiMedium", /* dftt-k5.ttf; version 1.00, 1992 */
189 "DLCLiShu", /* dftt-l5.ttf; version 1.00, 1992 */
190 "DLCRoundBold", /* dftt-r7.ttf; version 1.00, 1993 */
191 "HuaTianKaiTi?", /* htkt2.ttf */
192 "HuaTianSongTi?", /* htst3.ttf */
193 "Ming(for ISO10646)", /* hkscsiic.ttf; version 0.12, 2007 [Ming] */
194 /* iicore.ttf; version 0.07, 2007 [Ming] */
195 "MingLiU", /* mingliu.ttf */
196 /* mingliu.ttc; version 3.21, 2001 */
197 "MingMedium", /* dftt-m5.ttf; version 1.00, 1993 [DLCMingMedium] */
198 "PMingLiU", /* mingliu.ttc; version 3.21, 2001 */
199 "MingLi43", /* mingli.ttf; version 1.00, 1992 */
200 };
201
202 int nn;
203
204
205 for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )
206 if ( ft_strstr( name, trick_names[nn] ) )
207 return TRUE;
208
209 return FALSE;
210 }
#define ft_strstr
Definition: ftstdlib.h:92
Definition: name.c:39
#define TRICK_NAMES_MAX_CHARACTERS
#define TRICK_NAMES_COUNT

Referenced by tt_check_trickyness().

◆ tt_check_trickyness_sfnt_ids()

static FT_Bool tt_check_trickyness_sfnt_ids ( TT_Face  face)
static

Definition at line 278 of file ttobjs.c.

279 {
280#define TRICK_SFNT_IDS_PER_FACE 3
281#define TRICK_SFNT_IDS_NUM_FACES 29
282
283 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]
285
286#define TRICK_SFNT_ID_cvt 0
287#define TRICK_SFNT_ID_fpgm 1
288#define TRICK_SFNT_ID_prep 2
289
290 { /* MingLiU 1995 */
291 { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
292 { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
293 { 0xA344A1EAUL, 0x000001E1UL } /* prep */
294 },
295 { /* MingLiU 1996- */
296 { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
297 { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
298 { 0xA344A1EBUL, 0x000001E1UL } /* prep */
299 },
300 { /* DFGothic-EB */
301 { 0x12C3EBB2UL, 0x00000350UL }, /* cvt */
302 { 0xB680EE64UL, 0x000087A7UL }, /* fpgm */
303 { 0xCE939563UL, 0x00000758UL } /* prep */
304 },
305 { /* DFGyoSho-Lt */
306 { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
307 { 0xCE5956E9UL, 0x0000BC85UL }, /* fpgm */
308 { 0x8272F416UL, 0x00000045UL } /* prep */
309 },
310 { /* DFHei-Md-HK-BF */
311 { 0x1257EB46UL, 0x00000350UL }, /* cvt */
312 { 0xF699D160UL, 0x0000715FUL }, /* fpgm */
313 { 0xD222F568UL, 0x000003BCUL } /* prep */
314 },
315 { /* DFHSGothic-W5 */
316 { 0x1262EB4EUL, 0x00000350UL }, /* cvt */
317 { 0xE86A5D64UL, 0x00007940UL }, /* fpgm */
318 { 0x7850F729UL, 0x000005FFUL } /* prep */
319 },
320 { /* DFHSMincho-W3 */
321 { 0x122DEB0AUL, 0x00000350UL }, /* cvt */
322 { 0x3D16328AUL, 0x0000859BUL }, /* fpgm */
323 { 0xA93FC33BUL, 0x000002CBUL } /* prep */
324 },
325 { /* DFHSMincho-W7 */
326 { 0x125FEB26UL, 0x00000350UL }, /* cvt */
327 { 0xA5ACC982UL, 0x00007EE1UL }, /* fpgm */
328 { 0x90999196UL, 0x0000041FUL } /* prep */
329 },
330 { /* DFKaiShu */
331 { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
332 { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */
333 { 0x13A42602UL, 0x0000007EUL } /* prep */
334 },
335 { /* DFKaiShu, variant */
336 { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
337 { 0xA6E78C01UL, 0x00008998UL }, /* fpgm */
338 { 0x13A42602UL, 0x0000007EUL } /* prep */
339 },
340 { /* DFKaiShu-Md-HK-BF */
341 { 0x11E5EAD4UL, 0x00000360UL }, /* cvt */
342 { 0x9DB282B2UL, 0x0000C06EUL }, /* fpgm */
343 { 0x53E6D7CAUL, 0x00000082UL } /* prep */
344 },
345 { /* DFMing-Bd-HK-BF */
346 { 0x1243EB18UL, 0x00000350UL }, /* cvt */
347 { 0xBA0A8C30UL, 0x000074ADUL }, /* fpgm */
348 { 0xF3D83409UL, 0x0000037BUL } /* prep */
349 },
350 { /* DLCLiShu */
351 { 0x07DCF546UL, 0x00000308UL }, /* cvt */
352 { 0x40FE7C90UL, 0x00008E2AUL }, /* fpgm */
353 { 0x608174B5UL, 0x0000007AUL } /* prep */
354 },
355 { /* DLCHayBold */
356 { 0xEB891238UL, 0x00000308UL }, /* cvt */
357 { 0xD2E4DCD4UL, 0x0000676FUL }, /* fpgm */
358 { 0x8EA5F293UL, 0x000003B8UL } /* prep */
359 },
360 { /* HuaTianKaiTi */
361 { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
362 { 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */
363 { 0x70020112UL, 0x00000008UL } /* prep */
364 },
365 { /* HuaTianSongTi */
366 { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
367 { 0x0A5A0483UL, 0x00017C39UL }, /* fpgm */
368 { 0x70020112UL, 0x00000008UL } /* prep */
369 },
370 { /* NEC fadpop7.ttf */
371 { 0x00000000UL, 0x00000000UL }, /* cvt */
372 { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
373 { 0xA39B58E3UL, 0x0000117CUL } /* prep */
374 },
375 { /* NEC fadrei5.ttf */
376 { 0x00000000UL, 0x00000000UL }, /* cvt */
377 { 0x33C41652UL, 0x000000E5UL }, /* fpgm */
378 { 0x26D6C52AUL, 0x00000F6AUL } /* prep */
379 },
380 { /* NEC fangot7.ttf */
381 { 0x00000000UL, 0x00000000UL }, /* cvt */
382 { 0x6DB1651DUL, 0x0000019DUL }, /* fpgm */
383 { 0x6C6E4B03UL, 0x00002492UL } /* prep */
384 },
385 { /* NEC fangyo5.ttf */
386 { 0x00000000UL, 0x00000000UL }, /* cvt */
387 { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
388 { 0xDE51FAD0UL, 0x0000117CUL } /* prep */
389 },
390 { /* NEC fankyo5.ttf */
391 { 0x00000000UL, 0x00000000UL }, /* cvt */
392 { 0x85E47664UL, 0x000000E5UL }, /* fpgm */
393 { 0xA6C62831UL, 0x00001CAAUL } /* prep */
394 },
395 { /* NEC fanrgo5.ttf */
396 { 0x00000000UL, 0x00000000UL }, /* cvt */
397 { 0x2D891CFDUL, 0x0000019DUL }, /* fpgm */
398 { 0xA0604633UL, 0x00001DE8UL } /* prep */
399 },
400 { /* NEC fangot5.ttc */
401 { 0x00000000UL, 0x00000000UL }, /* cvt */
402 { 0x40AA774CUL, 0x000001CBUL }, /* fpgm */
403 { 0x9B5CAA96UL, 0x00001F9AUL } /* prep */
404 },
405 { /* NEC fanmin3.ttc */
406 { 0x00000000UL, 0x00000000UL }, /* cvt */
407 { 0x0D3DE9CBUL, 0x00000141UL }, /* fpgm */
408 { 0xD4127766UL, 0x00002280UL } /* prep */
409 },
410 { /* NEC FA-Gothic, 1996 */
411 { 0x00000000UL, 0x00000000UL }, /* cvt */
412 { 0x4A692698UL, 0x000001F0UL }, /* fpgm */
413 { 0x340D4346UL, 0x00001FCAUL } /* prep */
414 },
415 { /* NEC FA-Minchou, 1996 */
416 { 0x00000000UL, 0x00000000UL }, /* cvt */
417 { 0xCD34C604UL, 0x00000166UL }, /* fpgm */
418 { 0x6CF31046UL, 0x000022B0UL } /* prep */
419 },
420 { /* NEC FA-RoundGothicB, 1996 */
421 { 0x00000000UL, 0x00000000UL }, /* cvt */
422 { 0x5DA75315UL, 0x0000019DUL }, /* fpgm */
423 { 0x40745A5FUL, 0x000022E0UL } /* prep */
424 },
425 { /* NEC FA-RoundGothicM, 1996 */
426 { 0x00000000UL, 0x00000000UL }, /* cvt */
427 { 0xF055FC48UL, 0x000001C2UL }, /* fpgm */
428 { 0x3900DED3UL, 0x00001E18UL } /* prep */
429 },
430 { /* MINGLI.TTF, 1992 */
431 { 0x00170003UL, 0x00000060UL }, /* cvt */
432 { 0xDBB4306EUL, 0x000058AAUL }, /* fpgm */
433 { 0xD643482AUL, 0x00000035UL } /* prep */
434 }
435 };
436
438 int num_matched_ids[TRICK_SFNT_IDS_NUM_FACES];
439 FT_Bool has_cvt, has_fpgm, has_prep;
440 FT_UShort i;
441 int j, k;
442
443
444 FT_MEM_SET( num_matched_ids, 0,
445 sizeof ( int ) * TRICK_SFNT_IDS_NUM_FACES );
446 has_cvt = FALSE;
447 has_fpgm = FALSE;
448 has_prep = FALSE;
449
450 for ( i = 0; i < face->num_tables; i++ )
451 {
452 checksum = 0;
453
454 switch( face->dir_tables[i].Tag )
455 {
456 case TTAG_cvt:
458 has_cvt = TRUE;
459 break;
460
461 case TTAG_fpgm:
463 has_fpgm = TRUE;
464 break;
465
466 case TTAG_prep:
468 has_prep = TRUE;
469 break;
470
471 default:
472 continue;
473 }
474
475 for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )
476 if ( face->dir_tables[i].Length == sfnt_id[j][k].Length )
477 {
478 if ( !checksum )
480
481 if ( sfnt_id[j][k].CheckSum == checksum )
482 num_matched_ids[j]++;
483
484 if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
485 return TRUE;
486 }
487 }
488
489 for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )
490 {
491 if ( !has_cvt && !sfnt_id[j][TRICK_SFNT_ID_cvt].Length )
492 num_matched_ids[j]++;
493 if ( !has_fpgm && !sfnt_id[j][TRICK_SFNT_ID_fpgm].Length )
494 num_matched_ids[j]++;
495 if ( !has_prep && !sfnt_id[j][TRICK_SFNT_ID_prep].Length )
496 num_matched_ids[j]++;
497 if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
498 return TRUE;
499 }
500
501 return FALSE;
502 }
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
Definition: fdi.c:353
#define FT_MEM_SET(dest, byte, count)
Definition: ftmemory.h:225
unsigned short FT_UShort
Definition: fttypes.h:209
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 GLint GLint j
Definition: glfuncs.h:250
int k
Definition: mpi.c:3369
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define TRICK_SFNT_IDS_PER_FACE
#define TRICK_SFNT_IDS_NUM_FACES
#define TRICK_SFNT_ID_cvt
static FT_ULong tt_get_sfnt_checksum(TT_Face face, FT_UShort i)
Definition: ttobjs.c:247
#define TRICK_SFNT_ID_prep
#define TRICK_SFNT_ID_fpgm
#define TTAG_prep
Definition: tttags.h:94
#define TTAG_cvt
Definition: tttags.h:52
#define TTAG_fpgm
Definition: tttags.h:59

Referenced by tt_check_trickyness().

◆ tt_driver_done()

tt_driver_done ( FT_Module  ttdriver)

Definition at line 1440 of file ttobjs.c.

1441 {
1442 FT_UNUSED( ttdriver );
1443 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:100

◆ tt_driver_init()

tt_driver_init ( FT_Module  ttdriver)

Definition at line 1402 of file ttobjs.c.

1403 {
1404
1405#ifdef TT_USE_BYTECODE_INTERPRETER
1406
1407 TT_Driver driver = (TT_Driver)ttdriver;
1408
1409 driver->interpreter_version = TT_INTERPRETER_VERSION_35;
1410#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
1411 driver->interpreter_version = TT_INTERPRETER_VERSION_38;
1412#endif
1413#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
1414 driver->interpreter_version = TT_INTERPRETER_VERSION_40;
1415#endif
1416
1417#else /* !TT_USE_BYTECODE_INTERPRETER */
1418
1419 FT_UNUSED( ttdriver );
1420
1421#endif /* !TT_USE_BYTECODE_INTERPRETER */
1422
1423 return FT_Err_Ok;
1424 }
return FT_Err_Ok
Definition: ftbbox.c:527
#define TT_INTERPRETER_VERSION_38
Definition: ftdriver.h:749
#define TT_INTERPRETER_VERSION_40
Definition: ftdriver.h:750
#define TT_INTERPRETER_VERSION_35
Definition: ftdriver.h:748
struct @1717::@1718 driver
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
Definition: ttobjs.h:39

◆ tt_face_done()

tt_face_done ( FT_Face  ttface)

Definition at line 769 of file ttobjs.c.

770 {
771 TT_Face face = (TT_Face)ttface;
775
776
777 if ( !face )
778 return;
779
780 memory = ttface->memory;
781 stream = ttface->stream;
782 sfnt = (SFNT_Service)face->sfnt;
783
784 /* for `extended TrueType formats' (i.e. compressed versions) */
785 if ( face->extra.finalizer )
786 face->extra.finalizer( face->extra.data );
787
788 if ( sfnt )
789 sfnt->done_face( face );
790
791 /* freeing the locations table */
793
795
796 /* freeing the CVT */
797 FT_FREE( face->cvt );
798 face->cvt_size = 0;
799
800 /* freeing the programs */
801 FT_FRAME_RELEASE( face->font_program );
802 FT_FRAME_RELEASE( face->cvt_program );
803 face->font_program_size = 0;
804 face->cvt_program_size = 0;
805
806#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
807 tt_done_blend( face );
808 face->blend = NULL;
809#endif
810 }
#define NULL
Definition: types.h:112
#define FT_FREE(ptr)
Definition: ftmemory.h:328
#define FT_FRAME_RELEASE(bytes)
Definition: ftstream.h:551
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
if(dx< 0)
Definition: linetemp.h:194
static char memory[1024 *256]
Definition: process.c:116
SFNT_Interface * SFNT_Service
Definition: sfnt.h:784
FT_Stream stream
Definition: freetype.h:1086
FT_Memory memory
Definition: freetype.h:1085
TT_Done_Face_Func done_face
Definition: sfnt.h:716
Definition: parse.h:23
SFNT_Service sfnt
Definition: ttdriver.c:209
tt_face_free_hdmx(TT_Face face)
Definition: ttpload.c:612
tt_face_done_loca(TT_Face face)
Definition: ttpload.c:291

◆ tt_face_init()

tt_face_init ( FT_Stream  stream,
FT_Face  ttface,
FT_Int  face_index,
FT_Int  num_params,
FT_Parameter params 
)

Definition at line 606 of file ttobjs.c.

611 {
615 TT_Face face = (TT_Face)ttface;
616
617
618 FT_TRACE2(( "TTF driver\n" ));
619
620 library = ttface->driver->root.library;
621
623 if ( !sfnt )
624 {
625 FT_ERROR(( "tt_face_init: cannot access `sfnt' module\n" ));
626 error = FT_THROW( Missing_Module );
627 goto Exit;
628 }
629
630 /* create input stream from resource */
631 if ( FT_STREAM_SEEK( 0 ) )
632 goto Exit;
633
634 /* check that we have a valid TrueType file */
635 FT_TRACE2(( " " ));
636 error = sfnt->init_face( stream, face, face_index, num_params, params );
637
638 /* Stream may have changed. */
639 stream = face->root.stream;
640
641 if ( error )
642 goto Exit;
643
644 /* We must also be able to accept Mac/GX fonts, as well as OT ones. */
645 /* The 0x00020000 tag is completely undocumented; some fonts from */
646 /* Arphic made for Chinese Windows 3.1 have this. */
647 if ( face->format_tag != 0x00010000L && /* MS fonts */
648 face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
649 face->format_tag != TTAG_true && /* Mac fonts */
650 face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X) */
651 face->format_tag != TTAG_0xA5lst ) /* `LastResort.dfont' (legacy Mac OS X) */
652 {
653 FT_TRACE2(( " not a TTF font\n" ));
654 goto Bad_Format;
655 }
656
657#ifdef TT_USE_BYTECODE_INTERPRETER
659#endif
660
661 /* If we are performing a simple font format check, exit immediately. */
662 if ( face_index < 0 )
663 return FT_Err_Ok;
664
665 /* Load font directory */
666 error = sfnt->load_face( stream, face, face_index, num_params, params );
667 if ( error )
668 goto Exit;
669
670 if ( tt_check_trickyness( ttface ) )
672
674 if ( error )
675 goto Exit;
676
677 if ( FT_IS_SCALABLE( ttface ) )
678 {
679#ifdef FT_CONFIG_OPTION_INCREMENTAL
680 if ( !ttface->internal->incremental_interface )
681#endif
682 {
684
685 /* having a (non-zero) `glyf' table without */
686 /* a `loca' table is not valid */
687 if ( face->glyf_len && FT_ERR_EQ( error, Table_Missing ) )
688 goto Exit;
689 if ( error )
690 goto Exit;
691 }
692
693 /* `fpgm', `cvt', and `prep' are optional */
695 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
696 goto Exit;
697
699 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
700 goto Exit;
701
703 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
704 goto Exit;
705
706 /* Check the scalable flag based on `loca'. */
707#ifdef FT_CONFIG_OPTION_INCREMENTAL
708 if ( !ttface->internal->incremental_interface )
709#endif
710 {
711 if ( ttface->num_fixed_sizes &&
712 face->glyph_locations &&
713 tt_check_single_notdef( ttface ) )
714 {
715 FT_TRACE5(( "tt_face_init:"
716 " Only the `.notdef' glyph has an outline.\n"
717 " "
718 " Resetting scalable flag to FALSE.\n" ));
719
720 ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
721 }
722 }
723 }
724
725#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
726
727 {
728 FT_UInt instance_index = (FT_UInt)face_index >> 16;
729
730
731 if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
732 instance_index > 0 )
733 {
734 error = TT_Set_Named_Instance( face, instance_index );
735 if ( error )
736 goto Exit;
737
738 tt_apply_mvar( face );
739 }
740 }
741
742#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
743
744 /* initialize standard glyph loading routines */
746
747 Exit:
748 return error;
749
750 Bad_Format:
751 error = FT_THROW( Unknown_File_Format );
752 goto Exit;
753 }
FT_Library library
Definition: cffdrivr.c:661
#define FT_FACE_FLAG_HINTER
Definition: freetype.h:1221
#define FT_HAS_MULTIPLE_MASTERS(face)
Definition: freetype.h:1374
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1284
#define FT_FACE_FLAG_TRICKY
Definition: freetype.h:1223
#define FT_ERROR(varformat)
Definition: ftdebug.h:209
#define FT_TRACE5(varformat)
Definition: ftdebug.h:190
#define FT_THROW(e)
Definition: ftdebug.h:241
#define FT_TRACE2(varformat)
Definition: ftdebug.h:187
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:4992
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:514
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:604
#define FT_ERR_NEQ(x, e)
Definition: fttypes.h:606
GLenum const GLfloat * params
Definition: glext.h:5645
static void Exit(void)
Definition: sock.c:1330
FT_ModuleRec root
Definition: ftobjs.h:803
FT_Driver driver
Definition: freetype.h:1084
FT_Int num_fixed_sizes
Definition: freetype.h:1054
FT_Face_Internal internal
Definition: freetype.h:1093
FT_Long face_flags
Definition: freetype.h:1046
FT_Library library
Definition: ftobjs.h:503
TT_Init_Face_Func init_face
Definition: sfnt.h:714
TT_Load_Face_Func load_face
Definition: sfnt.h:715
TT_Init_Glyph_Loading(TT_Face face)
Definition: ttgload.c:761
static FT_Bool tt_check_trickyness(FT_Face face)
Definition: ttobjs.c:506
static FT_Bool tt_check_single_notdef(FT_Face ttface)
Definition: ttobjs.c:528
tt_face_load_prep(TT_Face face, FT_Stream stream)
Definition: ttpload.c:469
tt_face_load_cvt(TT_Face face, FT_Stream stream)
Definition: ttpload.c:322
tt_face_load_fpgm(TT_Face face, FT_Stream stream)
Definition: ttpload.c:405
tt_face_load_hdmx(TT_Face face, FT_Stream stream)
Definition: ttpload.c:532
tt_face_load_loca(TT_Face face, FT_Stream stream)
Definition: ttpload.c:64
#define TTAG_true
Definition: tttags.h:100
#define TTAG_0xA5kbd
Definition: tttags.h:112
#define TTAG_0xA5lst
Definition: tttags.h:115

◆ tt_get_sfnt_checksum()

static FT_ULong tt_get_sfnt_checksum ( TT_Face  face,
FT_UShort  i 
)
static

Definition at line 247 of file ttobjs.c.

249 {
250#if 0 /* if we believe the written value, use following part. */
251 if ( face->dir_tables[i].CheckSum )
252 return face->dir_tables[i].CheckSum;
253#endif
254
255 if ( !face->goto_table )
256 return 0;
257
258 if ( face->goto_table( face,
259 face->dir_tables[i].Tag,
260 face->root.stream,
261 NULL ) )
262 return 0;
263
264 return (FT_ULong)tt_synth_sfnt_checksum( face->root.stream,
265 face->dir_tables[i].Length );
266 }
static FT_UInt32 tt_synth_sfnt_checksum(FT_Stream stream, FT_ULong length)
Definition: ttobjs.c:221

Referenced by tt_check_trickyness_sfnt_ids().

◆ tt_size_done()

tt_size_done ( FT_Size  ttsize)

Definition at line 1262 of file ttobjs.c.

1263 {
1264 TT_Size size = (TT_Size)ttsize;
1265
1266
1267#ifdef TT_USE_BYTECODE_INTERPRETER
1268 tt_size_done_bytecode( ttsize );
1269#endif
1270
1271 size->ttmetrics.valid = FALSE;
1272 }
GLsizeiptr size
Definition: glext.h:5919
struct TT_SizeRec_ * TT_Size
Definition: tttypes.h:1796

◆ tt_size_init()

tt_size_init ( FT_Size  ttsize)

Definition at line 1231 of file ttobjs.c.

1232 {
1233 TT_Size size = (TT_Size)ttsize;
1235
1236
1237#ifdef TT_USE_BYTECODE_INTERPRETER
1238 size->bytecode_ready = -1;
1239 size->cvt_ready = -1;
1240#endif
1241
1242 size->ttmetrics.valid = FALSE;
1243 size->strike_index = 0xFFFFFFFFUL;
1244
1245 return error;
1246 }

◆ tt_size_reset()

tt_size_reset ( TT_Size  size,
FT_Bool  only_height 
)

Definition at line 1294 of file ttobjs.c.

1296 {
1297 TT_Face face;
1298 FT_Size_Metrics* size_metrics;
1299
1300
1301 face = (TT_Face)size->root.face;
1302
1303 /* nothing to do for CFF2 */
1304 if ( face->is_cff2 )
1305 return FT_Err_Ok;
1306
1307 size->ttmetrics.valid = FALSE;
1308
1309 size_metrics = &size->hinted_metrics;
1310
1311 /* copy the result from base layer */
1312 *size_metrics = size->root.metrics;
1313
1314 if ( size_metrics->x_ppem < 1 || size_metrics->y_ppem < 1 )
1315 return FT_THROW( Invalid_PPem );
1316
1317 /* This bit flag, if set, indicates that the ppems must be */
1318 /* rounded to integers. Nearly all TrueType fonts have this bit */
1319 /* set, as hinting won't work really well otherwise. */
1320 /* */
1321 if ( face->header.Flags & 8 )
1322 {
1323 /* the TT spec always asks for ROUND, not FLOOR or CEIL */
1324 size_metrics->ascender = FT_PIX_ROUND(
1325 FT_MulFix( face->root.ascender,
1326 size_metrics->y_scale ) );
1327 size_metrics->descender = FT_PIX_ROUND(
1328 FT_MulFix( face->root.descender,
1329 size_metrics->y_scale ) );
1330 size_metrics->height = FT_PIX_ROUND(
1331 FT_MulFix( face->root.height,
1332 size_metrics->y_scale ) );
1333 }
1334
1335 size->ttmetrics.valid = TRUE;
1336
1337 if ( only_height )
1338 {
1339 /* we must not recompute the scaling values here since */
1340 /* `tt_size_reset' was already called (with only_height = 0) */
1341 return FT_Err_Ok;
1342 }
1343
1344 if ( face->header.Flags & 8 )
1345 {
1346 /* base scaling values on integer ppem values, */
1347 /* as mandated by the TrueType specification */
1348 size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6,
1349 face->root.units_per_EM );
1350 size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6,
1351 face->root.units_per_EM );
1352
1353 size_metrics->max_advance = FT_PIX_ROUND(
1354 FT_MulFix( face->root.max_advance_width,
1355 size_metrics->x_scale ) );
1356 }
1357
1358 /* compute new transformation */
1359 if ( size_metrics->x_ppem >= size_metrics->y_ppem )
1360 {
1361 size->ttmetrics.scale = size_metrics->x_scale;
1362 size->ttmetrics.ppem = size_metrics->x_ppem;
1363 size->ttmetrics.x_ratio = 0x10000L;
1364 size->ttmetrics.y_ratio = FT_DivFix( size_metrics->y_ppem,
1365 size_metrics->x_ppem );
1366 }
1367 else
1368 {
1369 size->ttmetrics.scale = size_metrics->y_scale;
1370 size->ttmetrics.ppem = size_metrics->y_ppem;
1371 size->ttmetrics.x_ratio = FT_DivFix( size_metrics->x_ppem,
1372 size_metrics->y_ppem );
1373 size->ttmetrics.y_ratio = 0x10000L;
1374 }
1375
1376 size->metrics = size_metrics;
1377
1378#ifdef TT_USE_BYTECODE_INTERPRETER
1379 size->cvt_ready = -1;
1380#endif /* TT_USE_BYTECODE_INTERPRETER */
1381
1382 return FT_Err_Ok;
1383 }
WORD face[3]
Definition: mesh.c:4747
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:608
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
#define FT_PIX_ROUND(x)
Definition: ftobjs.h:92
FT_Fixed y_scale
Definition: freetype.h:1614
FT_Fixed x_scale
Definition: freetype.h:1613
FT_Pos descender
Definition: freetype.h:1617
FT_UShort x_ppem
Definition: freetype.h:1610
FT_UShort y_ppem
Definition: freetype.h:1611
FT_Pos max_advance
Definition: freetype.h:1619

Referenced by tt_size_request().

◆ tt_slot_init()

tt_slot_init ( FT_GlyphSlot  slot)

Definition at line 1462 of file ttobjs.c.

1463 {
1464 return FT_GlyphLoader_CreateExtra( slot->internal->loader );
1465 }
FT_GlyphLoader_CreateExtra(FT_GlyphLoader loader)
Definition: ftgloadr.c:166
Definition: vfat.h:185

◆ tt_synth_sfnt_checksum()

static FT_UInt32 tt_synth_sfnt_checksum ( FT_Stream  stream,
FT_ULong  length 
)
static

Definition at line 221 of file ttobjs.c.

223 {
225 FT_UInt32 checksum = 0;
226 FT_UInt i;
227
228
229 if ( FT_FRAME_ENTER( length ) )
230 return 0;
231
232 for ( ; length > 3; length -= 4 )
233 checksum += (FT_UInt32)FT_GET_ULONG();
234
235 for ( i = 3; length > 0; length--, i-- )
236 checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );
237
239
240 return checksum;
241 }
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:537
#define FT_GET_ULONG()
Definition: ftstream.h:304
#define FT_GET_BYTE()
Definition: ftstream.h:298
#define FT_FRAME_EXIT()
Definition: ftstream.h:542
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

Referenced by tt_get_sfnt_checksum().