From f51a02a29e10fcc490ba28f44d43f50104f940ed Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 19 Apr 2017 12:46:53 -0400 Subject: Cleanup codepage and charset definitions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl cleans up the unused defines in fx_codepage.h. The FXFONT_CHARSET_ defines are replaced with fx_codepage defines, this moves fx_codepage into core instead of xfa only. Static asserts are added to verify the public/ charsets match the fx_codepage charsets. Change-Id: Ie2f749e093de60a9a6743128a1fb087912e4cc96 Reviewed-on: https://pdfium-review.googlesource.com/4316 Commit-Queue: dsinclair Commit-Queue: Nicolás Peña Reviewed-by: Nicolás Peña --- core/fxge/win32/fx_win32_device.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'core/fxge/win32/fx_win32_device.cpp') diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 73a1ac6a0e..986839ee88 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -12,6 +12,7 @@ #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/cfx_maybe_owned.h" +#include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_system.h" #include "core/fxge/cfx_windowsdevice.h" @@ -448,7 +449,7 @@ bool CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { m_pMapper = pMapper; LOGFONTA lf; memset(&lf, 0, sizeof(LOGFONTA)); - lf.lfCharSet = FXFONT_DEFAULT_CHARSET; + lf.lfCharSet = FX_CHARSET_Default; lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t) this, @@ -486,10 +487,10 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight, } bool bCJK = true; switch (charset) { - case FXFONT_SHIFTJIS_CHARSET: - case FXFONT_GB2312_CHARSET: - case FXFONT_CHINESEBIG5_CHARSET: - case FXFONT_HANGUL_CHARSET: + case FX_CHARSET_ShiftJIS: + case FX_CHARSET_ChineseSimplified: + case FX_CHARSET_ChineseTraditional: + case FX_CHARSET_Hangul: break; default: bCJK = false; @@ -582,17 +583,17 @@ void* CFX_Win32FontInfo::MapFont(int weight, iExact = true; break; } - if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) { - charset = FXFONT_DEFAULT_CHARSET; - } + if (charset == FX_CHARSET_ANSI || charset == FX_CHARSET_Symbol) + charset = FX_CHARSET_Default; + int subst_pitch_family = pitch_family; switch (charset) { - case FXFONT_SHIFTJIS_CHARSET: + case FX_CHARSET_ShiftJIS: subst_pitch_family = FF_ROMAN; break; - case FXFONT_CHINESEBIG5_CHARSET: - case FXFONT_HANGUL_CHARSET: - case FXFONT_GB2312_CHARSET: + case FX_CHARSET_ChineseTraditional: + case FX_CHARSET_Hangul: + case FX_CHARSET_ChineseSimplified: subst_pitch_family = 0; break; } @@ -619,20 +620,20 @@ void* CFX_Win32FontInfo::MapFont(int weight, return hFont; } ::DeleteObject(hFont); - if (charset == FXFONT_DEFAULT_CHARSET) + if (charset == FX_CHARSET_Default) return nullptr; switch (charset) { - case FXFONT_SHIFTJIS_CHARSET: + case FX_CHARSET_ShiftJIS: GetJapanesePreference(face, weight, pitch_family); break; - case FXFONT_GB2312_CHARSET: + case FX_CHARSET_ChineseSimplified: GetGBPreference(face, weight, pitch_family); break; - case FXFONT_HANGUL_CHARSET: + case FX_CHARSET_Hangul: face = "Gulim"; break; - case FXFONT_CHINESEBIG5_CHARSET: + case FX_CHARSET_ChineseTraditional: if (face.Find("MSung") >= 0) { face = "MingLiU"; } else { -- cgit v1.2.3