[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] parthw-pk-vf ab86ec6: [pk] Define `pk_cmap_class' functions.
From: |
Parth Wazurkar |
Subject: |
[freetype2] parthw-pk-vf ab86ec6: [pk] Define `pk_cmap_class' functions. |
Date: |
Thu, 12 Jul 2018 14:01:43 -0400 (EDT) |
branch: parthw-pk-vf
commit ab86ec699d04eb970e031e1db556cd34dc47fdae
Author: Parth Wazurkar <address@hidden>
Commit: Parth Wazurkar <address@hidden>
[pk] Define `pk_cmap_class' functions.
---
src/pk/pkdrivr.c | 48 +++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 43 insertions(+), 5 deletions(-)
diff --git a/src/pk/pkdrivr.c b/src/pk/pkdrivr.c
index 4fbf351..4ee96bd 100644
--- a/src/pk/pkdrivr.c
+++ b/src/pk/pkdrivr.c
@@ -42,7 +42,8 @@
typedef struct PK_CMapRec_
{
FT_CMapRec cmap;
- /* TO-DO */
+ FT_UInt32 bc; /* Beginning Character */
+ FT_UInt32 ec; /* End Character */
} PK_CMapRec, *PK_CMap;
@@ -50,7 +51,13 @@
pk_cmap_init( FT_CMap pkcmap,
FT_Pointer init_data )
{
- /* TO-DO */
+ PK_CMap cmap = (PK_CMap)pkcmap;
+ PK_Face face = (PK_Face)FT_CMAP_FACE( cmap );
+ FT_UNUSED( init_data );
+
+ cmap->bc = face->pk_glyph->code_min;
+ cmap->ec = face->pk_glyph->code_max;
+
return FT_Err_Ok;
}
@@ -58,7 +65,10 @@
FT_CALLBACK_DEF( void )
pk_cmap_done( FT_CMap pkcmap )
{
- /* TO-DO */
+ PK_CMap cmap = (PK_CMap)pkcmap;
+
+ cmap->bc = 0;
+ cmap->ec = -1;
}
@@ -66,7 +76,14 @@
pk_cmap_char_index( FT_CMap pkcmap,
FT_UInt32 char_code )
{
- /* TO-DO */
+ FT_UInt gindex = 0;
+ PK_CMap cmap = (PK_CMap)pkcmap;
+
+ char_code -= cmap->bc;
+
+ if ( char_code < cmap->ec - cmap->bc + 1 )
+ gindex = (FT_UInt)( char_code );
+
return gindex;
}
@@ -74,7 +91,28 @@
pk_cmap_char_next( FT_CMap pkcmap,
FT_UInt32 *achar_code )
{
- /* To-DO */
+ PK_CMap cmap = (PK_CMap)pkcmap;
+ FT_UInt gindex = 0;
+ FT_UInt32 result = 0;
+ FT_UInt32 char_code = *achar_code + 1;
+
+
+ if ( char_code <= cmap->bc )
+ {
+ result = cmap->bc;
+ gindex = 1;
+ }
+ else
+ {
+ char_code -= cmap->bc;
+ if ( char_code < cmap->ec - cmap->bc + 1 )
+ {
+ result = char_code;
+ gindex = (FT_UInt)( char_code );
+ }
+ }
+
+ *achar_code = result;
return gindex;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] parthw-pk-vf ab86ec6: [pk] Define `pk_cmap_class' functions.,
Parth Wazurkar <=