int32_t CPWL_FontMap::GetNativeCharset()
{
	uint8_t nCharset = ANSI_CHARSET;
	int32_t iCodePage = FXSYS_GetACP();
	switch (iCodePage)
	{
	case 932://Japan
		nCharset = SHIFTJIS_CHARSET;
		break;
	case 936://Chinese (PRC, Singapore)
		nCharset = GB2312_CHARSET;
		break;
	case 950://Chinese (Taiwan; Hong Kong SAR, PRC)
		nCharset = GB2312_CHARSET;
		break;
	case 1252://Windows 3.1 Latin 1 (US, Western Europe)
		nCharset = ANSI_CHARSET;
		break;
	case 874://Thai
		nCharset = THAI_CHARSET;
		break;
	case 949://Korean
		nCharset = HANGUL_CHARSET;
		break;
	case 1200://Unicode (BMP of ISO 10646)
		nCharset = ANSI_CHARSET;
		break;
	case 1250://Windows 3.1 Eastern European
		nCharset = EASTEUROPE_CHARSET;
		break;
	case 1251://Windows 3.1 Cyrillic
		nCharset = RUSSIAN_CHARSET;
		break;
	case 1253://Windows 3.1 Greek
		nCharset = GREEK_CHARSET;
		break;
	case 1254://Windows 3.1 Turkish
		nCharset = TURKISH_CHARSET;
		break;
	case 1255://Hebrew
		nCharset = HEBREW_CHARSET;
		break;
	case 1256://Arabic
		nCharset = ARABIC_CHARSET;
		break;
	case 1257://Baltic
		nCharset = BALTIC_CHARSET;
		break;
	case 1258://Vietnamese
		nCharset = VIETNAMESE_CHARSET;
		break;
	case 1361://Korean(Johab)
		nCharset = JOHAB_CHARSET;
		break;
	}
	return nCharset;
}
Exemple #2
0
FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFontFamily,
                             FX_DWORD dwFontStyles,
                             FX_WORD wCodePage) {
  if (m_pFont) {
    return FALSE;
  }
  Lock();
  CFX_ByteString csFontFamily;
  if (pszFontFamily != NULL) {
    csFontFamily = CFX_ByteString::FromUnicode(pszFontFamily);
  }
  FX_DWORD dwFlags = 0;
  if (dwFontStyles & FX_FONTSTYLE_FixedPitch) {
    dwFlags |= FXFONT_FIXED_PITCH;
  }
  if (dwFontStyles & FX_FONTSTYLE_Serif) {
    dwFlags |= FXFONT_SERIF;
  }
  if (dwFontStyles & FX_FONTSTYLE_Symbolic) {
    dwFlags |= FXFONT_SYMBOLIC;
  }
  if (dwFontStyles & FX_FONTSTYLE_Script) {
    dwFlags |= FXFONT_SCRIPT;
  }
  if (dwFontStyles & FX_FONTSTYLE_Italic) {
    dwFlags |= FXFONT_ITALIC;
  }
  if (dwFontStyles & FX_FONTSTYLE_Bold) {
    dwFlags |= FXFONT_BOLD;
  }
  if (dwFontStyles & FX_FONTSTYLE_ExactMatch) {
    dwFlags |= FXFONT_EXACTMATCH;
  }
  int32_t iWeight =
      (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
  FX_WORD wCharSet = FX_GetCharsetFromCodePage(wCodePage);
  if (wCharSet == 0xFFFF) {
    wCharSet = FXSYS_GetACP();
  }
  m_wCharSet = wCharSet;
  m_pFont = new CFX_Font;
  if ((dwFlags & FXFONT_ITALIC) && (dwFlags & FXFONT_BOLD)) {
    csFontFamily += ",BoldItalic";
  } else if (dwFlags & FXFONT_BOLD) {
    csFontFamily += ",Bold";
  } else if (dwFlags & FXFONT_ITALIC) {
    csFontFamily += ",Italic";
  }
  m_pFont->LoadSubst(csFontFamily, TRUE, dwFlags, iWeight, 0, wCodePage);
  FX_BOOL bRet = m_pFont->GetFace() != nullptr;
  if (bRet) {
    bRet = InitFont();
  }
  Unlock();
  return bRet;
}
Exemple #3
0
void PDF_GetPageText(CFX_ByteStringArray& lines, CPDF_Document* pDoc, CPDF_Dictionary* pPage,
                     int iMinWidth, FX_DWORD flags)
{
    lines.RemoveAll();
    CFX_WideStringArray wlines;
    PDF_GetPageText_Unicode(wlines, pDoc, pPage, iMinWidth, flags);
    for (int i = 0; i < wlines.GetSize(); i ++) {
        CFX_WideString wstr = wlines[i];
        CFX_ByteString str;
        for (int c = 0; c < wstr.GetLength(); c ++) {
            str += CharFromUnicodeAlt(wstr[c], FXSYS_GetACP(), "?");
        }
        lines.Add(str);
    }
}