ReactOS 0.4.15-dev-5666-gc548b97
pfrcmap.c File Reference
#include <ft2build.h>
#include "pfrcmap.h"
#include "pfrobjs.h"
#include "pfrerror.h"
Include dependency graph for pfrcmap.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 pfr_cmap_init (PFR_CMap cmap, FT_Pointer pointer)
 
 pfr_cmap_done (PFR_CMap cmap)
 
 pfr_cmap_char_index (PFR_CMap cmap, FT_UInt32 char_code)
 
 pfr_cmap_char_next (PFR_CMap cmap, FT_UInt32 *pchar_code)
 

Variables

FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pfr_cmap_class_rec
 

Function Documentation

◆ pfr_cmap_char_index()

pfr_cmap_char_index ( PFR_CMap  cmap,
FT_UInt32  char_code 
)

Definition at line 70 of file pfrcmap.c.

72 {
73 FT_UInt min = 0;
74 FT_UInt max = cmap->num_chars;
75
76
77 while ( min < max )
78 {
79 PFR_Char gchar;
80 FT_UInt mid;
81
82
83 mid = min + ( max - min ) / 2;
84 gchar = cmap->chars + mid;
85
86 if ( gchar->char_code == char_code )
87 return mid + 1;
88
89 if ( gchar->char_code < char_code )
90 min = mid + 1;
91 else
92 max = mid;
93 }
94 return 0;
95 }
unsigned int FT_UInt
Definition: fttypes.h:231
#define min(a, b)
Definition: monoChain.cc:55
FT_UInt char_code
Definition: pfrtypes.h:157
#define max(a, b)
Definition: svc.c:63

◆ pfr_cmap_char_next()

pfr_cmap_char_next ( PFR_CMap  cmap,
FT_UInt32 *  pchar_code 
)

Definition at line 99 of file pfrcmap.c.

101 {
102 FT_UInt result = 0;
103 FT_UInt32 char_code = *pchar_code + 1;
104
105
106 Restart:
107 {
108 FT_UInt min = 0;
109 FT_UInt max = cmap->num_chars;
110 FT_UInt mid;
111 PFR_Char gchar;
112
113
114 while ( min < max )
115 {
116 mid = min + ( ( max - min ) >> 1 );
117 gchar = cmap->chars + mid;
118
119 if ( gchar->char_code == char_code )
120 {
121 result = mid;
122 if ( result != 0 )
123 {
124 result++;
125 goto Exit;
126 }
127
128 char_code++;
129 goto Restart;
130 }
131
132 if ( gchar->char_code < char_code )
133 min = mid + 1;
134 else
135 max = mid;
136 }
137
138 /* we didn't find it, but we have a pair just above it */
139 char_code = 0;
140
141 if ( min < cmap->num_chars )
142 {
143 gchar = cmap->chars + min;
144 result = min;
145 if ( result != 0 )
146 {
147 result++;
148 char_code = gchar->char_code;
149 }
150 }
151 }
152
153 Exit:
154 *pchar_code = char_code;
155 return result;
156 }
GLuint64EXT * result
Definition: glext.h:11304
@ Restart
Definition: sacdrv.h:269
static void Exit(void)
Definition: sock.c:1330

◆ pfr_cmap_done()

pfr_cmap_done ( PFR_CMap  cmap)

Definition at line 62 of file pfrcmap.c.

63 {
64 cmap->chars = NULL;
65 cmap->num_chars = 0;
66 }
#define NULL
Definition: types.h:112

◆ pfr_cmap_init()

pfr_cmap_init ( PFR_CMap  cmap,
FT_Pointer  pointer 
)

Definition at line 28 of file pfrcmap.c.

30 {
33
35
36
37 cmap->num_chars = face->phy_font.num_chars;
38 cmap->chars = face->phy_font.chars;
39
40 /* just for safety, check that the character entries are correctly */
41 /* sorted in increasing character code order */
42 {
43 FT_UInt n;
44
45
46 for ( n = 1; n < cmap->num_chars; n++ )
47 {
48 if ( cmap->chars[n - 1].char_code >= cmap->chars[n].char_code )
49 {
50 error = FT_THROW( Invalid_Table );
51 goto Exit;
52 }
53 }
54 }
55
56 Exit:
57 return error;
58 }
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
int FT_Error
Definition: fttypes.h:300
GLdouble n
Definition: glext.h:7729
GLsizei const GLvoid * pointer
Definition: glext.h:5848
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define error(str)
Definition: mkdosfs.c:1605
typedefFT_BEGIN_HEADER struct PFR_FaceRec_ * PFR_Face
Definition: pfrobjs.h:27

Variable Documentation

◆ pfr_cmap_class_rec

Initial value:
=
{
sizeof ( PFR_CMapRec ),
}
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:181
FT_UInt(* FT_CMap_CharVarIndexFunc)(FT_CMap cmap, FT_CMap unicode_cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:185
FT_Bool(* FT_CMap_CharVarIsDefaultFunc)(FT_CMap cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:191
FT_UInt32 *(* FT_CMap_CharVariantListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 char_code)
Definition: ftobjs.h:200
FT_UInt32 *(* FT_CMap_VariantCharListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 variant_selector)
Definition: ftobjs.h:205
FT_UInt32 *(* FT_CMap_VariantListFunc)(FT_CMap cmap, FT_Memory mem)
Definition: ftobjs.h:196
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:170
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:174
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:177
pfr_cmap_init(PFR_CMap cmap, FT_Pointer pointer)
Definition: pfrcmap.c:28
pfr_cmap_done(PFR_CMap cmap)
Definition: pfrcmap.c:62
pfr_cmap_char_next(PFR_CMap cmap, FT_UInt32 *pchar_code)
Definition: pfrcmap.c:99
pfr_cmap_char_index(PFR_CMap cmap, FT_UInt32 char_code)
Definition: pfrcmap.c:70
FT_BEGIN_HEADER struct PFR_CMapRec_ PFR_CMapRec

Definition at line 160 of file pfrcmap.c.

Referenced by pfr_face_init().