ReactOS 0.4.16-dev-2332-g4cba65d
ttobjs.c File Reference
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/tttags.h>
#include <freetype/internal/sfnt.h>
#include <freetype/ftdriver.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 (const 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 45 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 527 of file ttobjs.c.

528 {
530
531 TT_Face face = (TT_Face)ttface;
532 FT_UInt asize;
533 FT_ULong i;
534 FT_ULong glyph_index = 0;
535 FT_UInt count = 0;
536
537
538 for( i = 0; i < face->num_locations; i++ )
539 {
540 tt_face_get_location( face, i, &asize );
541 if ( asize > 0 )
542 {
543 count += 1;
544 if ( count > 1 )
545 break;
546 glyph_index = i;
547 }
548 }
549
550 /* Only have a single outline. */
551 if ( count == 1 )
552 {
553 if ( glyph_index == 0 )
554 result = TRUE;
555 else
556 {
557 /* FIXME: Need to test glyphname == .notdef ? */
559 char buf[8];
560
561
562 error = FT_Get_Glyph_Name( ttface, glyph_index, buf, 8 );
563 if ( !error &&
564 buf[0] == '.' && !ft_strncmp( buf, ".notdef", 8 ) )
565 result = TRUE;
566 }
567 }
568
569 return result;
570 }
#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:4110
#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:196
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:988

Referenced by tt_face_init().

◆ tt_check_trickyness()

static FT_Bool tt_check_trickyness ( FT_Face  face)
static

Definition at line 505 of file ttobjs.c.

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

Referenced by tt_face_init().

◆ tt_check_trickyness_family()

static FT_Bool tt_check_trickyness_family ( const FT_String name)
static

Definition at line 150 of file ttobjs.c.

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

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

Referenced by tt_check_trickyness().

◆ tt_driver_done()

tt_driver_done ( FT_Module  ttdriver)

Definition at line 1448 of file ttobjs.c.

1449 {
1450 FT_UNUSED( ttdriver );
1451 }
#define FT_UNUSED(arg)

◆ tt_driver_init()

tt_driver_init ( FT_Module  ttdriver)

Definition at line 1410 of file ttobjs.c.

1411 {
1412
1413#ifdef TT_USE_BYTECODE_INTERPRETER
1414
1415 TT_Driver driver = (TT_Driver)ttdriver;
1416
1417 driver->interpreter_version = TT_INTERPRETER_VERSION_35;
1418#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
1419 driver->interpreter_version = TT_INTERPRETER_VERSION_38;
1420#endif
1421#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
1422 driver->interpreter_version = TT_INTERPRETER_VERSION_40;
1423#endif
1424
1425#else /* !TT_USE_BYTECODE_INTERPRETER */
1426
1427 FT_UNUSED( ttdriver );
1428
1429#endif /* !TT_USE_BYTECODE_INTERPRETER */
1430
1431 return FT_Err_Ok;
1432 }
return FT_Err_Ok
Definition: ftbbox.c:526
#define TT_INTERPRETER_VERSION_38
Definition: ftdriver.h:744
#define TT_INTERPRETER_VERSION_40
Definition: ftdriver.h:745
#define TT_INTERPRETER_VERSION_35
Definition: ftdriver.h:743
struct @1789::@1790 driver
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
Definition: ttobjs.h:38

◆ tt_face_done()

tt_face_done ( FT_Face  ttface)

Definition at line 768 of file ttobjs.c.

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

◆ 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 605 of file ttobjs.c.

610 {
614 TT_Face face = (TT_Face)ttface;
615
616
617 FT_TRACE2(( "TTF driver\n" ));
618
619 library = ttface->driver->root.library;
620
622 if ( !sfnt )
623 {
624 FT_ERROR(( "tt_face_init: cannot access `sfnt' module\n" ));
625 error = FT_THROW( Missing_Module );
626 goto Exit;
627 }
628
629 /* create input stream from resource */
630 if ( FT_STREAM_SEEK( 0 ) )
631 goto Exit;
632
633 /* check that we have a valid TrueType file */
634 FT_TRACE2(( " " ));
635 error = sfnt->init_face( stream, face, face_index, num_params, params );
636
637 /* Stream may have changed. */
638 stream = face->root.stream;
639
640 if ( error )
641 goto Exit;
642
643 /* We must also be able to accept Mac/GX fonts, as well as OT ones. */
644 /* The 0x00020000 tag is completely undocumented; some fonts from */
645 /* Arphic made for Chinese Windows 3.1 have this. */
646 if ( face->format_tag != 0x00010000L && /* MS fonts */
647 face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
648 face->format_tag != TTAG_true && /* Mac fonts */
649 face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X) */
650 face->format_tag != TTAG_0xA5lst ) /* `LastResort.dfont' (legacy Mac OS X) */
651 {
652 FT_TRACE2(( " not a TTF font\n" ));
653 goto Bad_Format;
654 }
655
656#ifdef TT_USE_BYTECODE_INTERPRETER
658#endif
659
660 /* If we are performing a simple font format check, exit immediately. */
661 if ( face_index < 0 )
662 return FT_Err_Ok;
663
664 /* Load font directory */
665 error = sfnt->load_face( stream, face, face_index, num_params, params );
666 if ( error )
667 goto Exit;
668
669 if ( tt_check_trickyness( ttface ) )
671
673 if ( error )
674 goto Exit;
675
676 if ( FT_IS_SCALABLE( ttface ) )
677 {
678#ifdef FT_CONFIG_OPTION_INCREMENTAL
679 if ( !ttface->internal->incremental_interface )
680#endif
681 {
683
684 /* having a (non-zero) `glyf' table without */
685 /* a `loca' table is not valid */
686 if ( face->glyf_len && FT_ERR_EQ( error, Table_Missing ) )
687 goto Exit;
688 if ( error )
689 goto Exit;
690 }
691
692 /* `fpgm', `cvt', and `prep' are optional */
694 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
695 goto Exit;
696
698 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
699 goto Exit;
700
702 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
703 goto Exit;
704
705 /* Check the scalable flag based on `loca'. */
706#ifdef FT_CONFIG_OPTION_INCREMENTAL
707 if ( !ttface->internal->incremental_interface )
708#endif
709 {
710 if ( ttface->num_fixed_sizes &&
711 face->glyph_locations &&
712 tt_check_single_notdef( ttface ) )
713 {
714 FT_TRACE5(( "tt_face_init:"
715 " Only the `.notdef' glyph has an outline.\n"
716 " "
717 " Resetting scalable flag to FALSE.\n" ));
718
719 ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
720 }
721 }
722 }
723
724#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
725
726 {
727 FT_UInt instance_index = (FT_UInt)face_index >> 16;
728
729
730 if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
731 instance_index > 0 )
732 {
733 error = TT_Set_Named_Instance( face, instance_index );
734 if ( error )
735 goto Exit;
736
737 tt_apply_mvar( face );
738 }
739 }
740
741#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
742
743 /* initialize standard glyph loading routines */
745
746 Exit:
747 return error;
748
749 Bad_Format:
750 error = FT_THROW( Unknown_File_Format );
751 goto Exit;
752 }
FT_Library library
Definition: cffdrivr.c:660
#define FT_FACE_FLAG_HINTER
Definition: freetype.h:1208
#define FT_HAS_MULTIPLE_MASTERS(face)
Definition: freetype.h:1361
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1271
#define FT_FACE_FLAG_TRICKY
Definition: freetype.h:1210
#define FT_ERROR(varformat)
Definition: ftdebug.h:211
#define FT_TRACE5(varformat)
Definition: ftdebug.h:192
#define FT_THROW(e)
Definition: ftdebug.h:243
#define FT_TRACE2(varformat)
Definition: ftdebug.h:189
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:5012
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:525
#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:801
FT_Driver driver
Definition: freetype.h:1071
FT_Int num_fixed_sizes
Definition: freetype.h:1041
FT_Face_Internal internal
Definition: freetype.h:1080
FT_Long face_flags
Definition: freetype.h:1033
FT_Library library
Definition: ftobjs.h:501
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:779
static FT_Bool tt_check_trickyness(FT_Face face)
Definition: ttobjs.c:505
static FT_Bool tt_check_single_notdef(FT_Face ttface)
Definition: ttobjs.c:527
tt_face_load_prep(TT_Face face, FT_Stream stream)
Definition: ttpload.c:468
tt_face_load_cvt(TT_Face face, FT_Stream stream)
Definition: ttpload.c:321
tt_face_load_fpgm(TT_Face face, FT_Stream stream)
Definition: ttpload.c:404
tt_face_load_hdmx(TT_Face face, FT_Stream stream)
Definition: ttpload.c:531
tt_face_load_loca(TT_Face face, FT_Stream stream)
Definition: ttpload.c:63
#define TTAG_true
Definition: tttags.h:99
#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 246 of file ttobjs.c.

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

Referenced by tt_check_trickyness_sfnt_ids().

◆ tt_size_done()

tt_size_done ( FT_Size  ttsize)

Definition at line 1270 of file ttobjs.c.

1271 {
1272 TT_Size size = (TT_Size)ttsize;
1273
1274
1275#ifdef TT_USE_BYTECODE_INTERPRETER
1276 tt_size_done_bytecode( ttsize );
1277#endif
1278
1279 size->ttmetrics.valid = FALSE;
1280 }
GLsizeiptr size
Definition: glext.h:5919
struct TT_SizeRec_ * TT_Size
Definition: tttypes.h:1722

◆ tt_size_init()

tt_size_init ( FT_Size  ttsize)

Definition at line 1239 of file ttobjs.c.

1240 {
1241 TT_Size size = (TT_Size)ttsize;
1243
1244
1245#ifdef TT_USE_BYTECODE_INTERPRETER
1246 size->bytecode_ready = -1;
1247 size->cvt_ready = -1;
1248#endif
1249
1250 size->ttmetrics.valid = FALSE;
1251 size->strike_index = 0xFFFFFFFFUL;
1252
1253 return error;
1254 }

◆ tt_size_reset()

tt_size_reset ( TT_Size  size,
FT_Bool  only_height 
)

Definition at line 1302 of file ttobjs.c.

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

Referenced by tt_size_request().

◆ tt_slot_init()

tt_slot_init ( FT_GlyphSlot  slot)

Definition at line 1470 of file ttobjs.c.

1471 {
1472 return FT_GlyphLoader_CreateExtra( slot->internal->loader );
1473 }
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 220 of file ttobjs.c.

222 {
224 FT_UInt32 checksum = 0;
225 FT_UInt i;
226
227
228 if ( FT_FRAME_ENTER( length ) )
229 return 0;
230
231 for ( ; length > 3; length -= 4 )
232 checksum += (FT_UInt32)FT_GET_ULONG();
233
234 for ( i = 3; length > 0; length--, i-- )
235 checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );
236
238
239 return checksum;
240 }
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:548
#define FT_GET_ULONG()
Definition: ftstream.h:315
#define FT_GET_BYTE()
Definition: ftstream.h:309
#define FT_FRAME_EXIT()
Definition: ftstream.h:553
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

Referenced by tt_get_sfnt_checksum().