Nikolay Sivov : dwrite: Use better integer types for cmap helpers.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Oct 16 09:44:21 CDT 2014
Module: wine
Branch: master
Commit: d3cdec0e66ef4222dea4b663b33ce871d7254eda
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d3cdec0e66ef4222dea4b663b33ce871d7254eda
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Oct 16 07:32:27 2014 +0400
dwrite: Use better integer types for cmap helpers.
---
dlls/dwrite/dwrite_private.h | 2 +-
dlls/dwrite/font.c | 5 ++---
dlls/dwrite/opentype.c | 33 +++++++++++++++++----------------
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index b3bd1df..f4a19c7 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -108,7 +108,7 @@ extern HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE
/* Opentype font table functions */
extern HRESULT opentype_analyze_font(IDWriteFontFileStream*,UINT32*,DWRITE_FONT_FILE_TYPE*,DWRITE_FONT_FACE_TYPE*,BOOL*) DECLSPEC_HIDDEN;
extern HRESULT opentype_get_font_table(IDWriteFontFileStream*,DWRITE_FONT_FACE_TYPE,UINT32,UINT32,const void**,void**,UINT32*,BOOL*) DECLSPEC_HIDDEN;
-extern VOID OpenType_CMAP_GetGlyphIndex(LPVOID data, DWORD utf32c, LPWORD pgi, DWORD flags) DECLSPEC_HIDDEN;
+extern void opentype_cmap_get_glyphindex(void*,UINT32,UINT16*) DECLSPEC_HIDDEN;
extern VOID get_font_properties(LPCVOID os2, LPCVOID head, LPCVOID post, DWRITE_FONT_METRICS *metrics, DWRITE_FONT_STRETCH *stretch, DWRITE_FONT_WEIGHT *weight, DWRITE_FONT_STYLE *style) DECLSPEC_HIDDEN;
extern HRESULT bidi_computelevels(const WCHAR*,UINT32,UINT8,UINT8*,UINT8*);
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 69b7746..e3edbaa 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -391,9 +391,8 @@ static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace2 *iface, UI
}
for (i = 0; i < count; i++)
- {
- OpenType_CMAP_GetGlyphIndex(This->cmap.data, codepoints[i], &glyph_indices[i], 0);
- }
+ opentype_cmap_get_glyphindex(This->cmap.data, codepoints[i], &glyph_indices[i]);
+
return S_OK;
}
}
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 9af04fd..dba3e31 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -96,6 +96,12 @@ typedef struct {
WORD endCode[1];
} CMAP_SegmentMapping_0;
+enum OPENTYPE_CMAP_TABLE_FORMAT
+{
+ OPENTYPE_CMAP_TABLE_SEGMENT_MAPPING = 4,
+ OPENTYPE_CMAP_TABLE_SEGMENTED_COVERAGE = 12
+};
+
/* PANOSE is 10 bytes in size, need to pack the structure properly */
#include "pshpack2.h"
typedef struct
@@ -301,7 +307,7 @@ static int compare_group(const void *a, const void* b)
return 0;
}
-static void CMAP4_GetGlyphIndex(CMAP_SegmentMapping_0* format, DWORD utf32c, LPWORD pgi)
+static void CMAP4_GetGlyphIndex(CMAP_SegmentMapping_0* format, UINT32 utf32c, UINT16 *pgi)
{
WORD *startCode;
SHORT *idDelta;
@@ -340,9 +346,9 @@ static void CMAP4_GetGlyphIndex(CMAP_SegmentMapping_0* format, DWORD utf32c, LPW
}
}
-static void CMAP12_GetGlyphIndex(CMAP_SegmentedCoverage* format, DWORD utf32c, LPWORD pgi)
+static void CMAP12_GetGlyphIndex(CMAP_SegmentedCoverage* format, UINT32 utf32c, UINT16 *pgi)
{
- CMAP_SegmentedCoverage_group *group = NULL;
+ CMAP_SegmentedCoverage_group *group;
group = bsearch(&utf32c, format->groups, GET_BE_DWORD(format->nGroups),
sizeof(CMAP_SegmentedCoverage_group), compare_group);
@@ -354,17 +360,12 @@ static void CMAP12_GetGlyphIndex(CMAP_SegmentedCoverage* format, DWORD utf32c, L
}
}
-VOID OpenType_CMAP_GetGlyphIndex(LPVOID data, DWORD utf32c, LPWORD pgi, DWORD flags)
+void opentype_cmap_get_glyphindex(void *data, UINT32 utf32c, UINT16 *pgi)
{
+ CMAP_Header *CMAP_Table = data;
int i;
- CMAP_Header *CMAP_Table = NULL;
-
- if (flags & GGI_MARK_NONEXISTING_GLYPHS)
- *pgi = 0xffff;
- else
- *pgi = 0;
- CMAP_Table = data;
+ *pgi = 0;
for (i = 0; i < GET_BE_WORD(CMAP_Table->numTables); i++)
{
@@ -376,18 +377,18 @@ VOID OpenType_CMAP_GetGlyphIndex(LPVOID data, DWORD utf32c, LPWORD pgi, DWORD fl
table = (WORD*)(((BYTE*)CMAP_Table) + GET_BE_DWORD(CMAP_Table->tables[i].offset));
type = GET_BE_WORD(*table);
- TRACE("Type %i\n", type);
+ TRACE("table type %i\n", type);
/* Break when we find a handled type */
- switch(type)
+ switch (type)
{
- case 4:
+ case OPENTYPE_CMAP_TABLE_SEGMENT_MAPPING:
CMAP4_GetGlyphIndex((CMAP_SegmentMapping_0*) table, utf32c, pgi);
break;
- case 12:
+ case OPENTYPE_CMAP_TABLE_SEGMENTED_COVERAGE:
CMAP12_GetGlyphIndex((CMAP_SegmentedCoverage*) table, utf32c, pgi);
break;
default:
- TRACE("Type %i unhandled.\n", type);
+ TRACE("table type %i unhandled.\n", type);
}
}
}
More information about the wine-cvs
mailing list