dwrite: Use better integer types for cmap helpers.
This commit is contained in:
parent
9b46e19aa4
commit
d3cdec0e66
|
@ -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*);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,18 +360,13 @@ 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;
|
||||
|
||||
for (i = 0; i < GET_BE_WORD(CMAP_Table->numTables); i++)
|
||||
{
|
||||
WORD type;
|
||||
|
@ -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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue