当前位置: 首页>>代码示例>>C++>>正文


C++ CFX_ByteString::Find方法代码示例

本文整理汇总了C++中CFX_ByteString::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteString::Find方法的具体用法?C++ CFX_ByteString::Find怎么用?C++ CFX_ByteString::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFX_ByteString的用法示例。


在下文中一共展示了CFX_ByteString::Find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FindFont

void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName)
{
    CFontFaceInfo* pFind = NULL;
    FX_DWORD charset_flag = _LinuxGetCharset(charset);
    int32_t iBestSimilar = 0;
    FX_POSITION pos = m_FontList.GetStartPosition();
    while (pos) {
        CFX_ByteString bsName;
        CFontFaceInfo* pFont = NULL;
        m_FontList.GetNextAssoc(pos, bsName, (void*&)pFont);
        if (!(pFont->m_Charsets & charset_flag) && charset != FXFONT_DEFAULT_CHARSET) {
            continue;
        }
        int32_t iSimilarValue = 0;
        int32_t index = bsName.Find(family);
        if (bMatchName && index < 0) {
            continue;
        }
        if (!bMatchName && index > 0) {
            iSimilarValue += 64;
        }
        iSimilarValue = _LinuxGetSimilarValue(weight, bItalic, pitch_family, pFont->m_Styles);
        if (iSimilarValue > iBestSimilar) {
            iBestSimilar = iSimilarValue;
            pFind = pFont;
        }
    }
    return pFind;
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:29,代码来源:fx_ge_linux.cpp

示例2: _GetFontFamily

static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle)
{
    if (fontName.Find("Script") >= 0) {
        if ((nStyle & FX_FONT_STYLE_Bold) == FX_FONT_STYLE_Bold) {
            fontName = "ScriptMTBold";
        } else if (fontName.Find("Palace") >= 0) {
            fontName = "PalaceScriptMT";
        } else if (fontName.Find("French") >= 0) {
            fontName = "FrenchScriptMT";
        } else if (fontName.Find("FreeStyle") >= 0) {
            fontName = "FreeStyleScript";
        }
        return fontName;
    }
    _AltFontFamily* found = (_AltFontFamily*)FXSYS_bsearch((FX_LPCSTR)fontName, g_AltFontFamilies,
                            sizeof g_AltFontFamilies / sizeof (_AltFontFamily), sizeof (_AltFontFamily), compareFontFamilyString);
    if (found == NULL) {
        return fontName;
    }
    return found->m_pFontFamily;
};
开发者ID:kakajika,项目名称:loilo-pdf,代码行数:21,代码来源:fx_ge_fontmap.cpp

示例3: GetJapanesePreference

static void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_family)
{
    if (face.Find("Gothic") >= 0) {
        face = JAPAN_GOTHIC;
        return;
    }
    if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) {
        face = JAPAN_GOTHIC;
    } else {
        face = JAPAN_MINCHO;
    }
}
开发者ID:aschepis,项目名称:pdfium,代码行数:12,代码来源:fx_mac_imp.cpp

示例4: GetURI

CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
  CFX_ByteString csURI;
  if (!m_pDict)
    return csURI;
  if (m_pDict->GetStringFor("S") != "URI")
    return csURI;

  csURI = m_pDict->GetStringFor("URI");
  CPDF_Dictionary* pRoot = pDoc->GetRoot();
  CPDF_Dictionary* pURI = pRoot->GetDictFor("URI");
  if (pURI) {
    if (csURI.Find(":", 0) < 1)
      csURI = pURI->GetStringFor("Base") + csURI;
  }
  return csURI;
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:16,代码来源:cpdf_action.cpp

示例5: GetJapanesePreference

static int32_t GetJapanesePreference(const FX_CHAR* facearr, int weight, int picth_family)
{
    CFX_ByteString face = facearr;
    if (face.Find("Gothic") >= 0 || face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) {
        if (face.Find("PGothic") >= 0 || face.Find("\x82\x6f\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) {
            return 0;
        } else {
            return 1;
        }
    } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) {
        if (face.Find("PMincho") >= 0 || face.Find("\x82\x6f\x96\xbe\x92\xa9") >= 0) {
            return 2;
        } else {
            return 3;
        }
    }
    if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) {
        return 0;
    }
    return 2;
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:21,代码来源:fx_ge_linux.cpp

示例6: FindSubstFont

FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTrueType, FX_DWORD flags,
                                        int weight, int italic_angle, int WindowCP, CFX_SubstFont* pSubstFont)
{
    if (!(flags & FXFONT_USEEXTERNATTR)) {
        weight = FXFONT_FW_NORMAL;
        italic_angle = 0;
    }
    CFX_ByteString SubstName = name;
    SubstName.Remove(0x20);
    if (bTrueType) {
        if (name[0] == '@') {
            SubstName = name.Mid(1);
        }
    }
    _PDF_GetStandardFontName(SubstName);
    if (SubstName == FX_BSTRC("Symbol") && !bTrueType) {
        pSubstFont->m_Family = "Chrome Symbol";
        pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
        pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
        if (m_FoxitFaces[12]) {
            return m_FoxitFaces[12];
        }
        FX_LPCBYTE pFontData = NULL;
        FX_DWORD size = 0;
        m_pFontMgr->GetStandardFont(pFontData, size, 12);
        m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
        return m_FoxitFaces[12];
    }
    if (SubstName == FX_BSTRC("ZapfDingbats")) {
        pSubstFont->m_Family = "Chrome Dingbats";
        pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
        pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
        if (m_FoxitFaces[13]) {
            return m_FoxitFaces[13];
        }
        FX_LPCBYTE pFontData = NULL;
        FX_DWORD size = 0;
        m_pFontMgr->GetStandardFont(pFontData, size, 13);
        m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
        return m_FoxitFaces[13];
    }
    int iBaseFont = 0;
    CFX_ByteString family, style;
    FX_BOOL	bHasComma = FALSE;
    FX_BOOL bHasHypen = FALSE;
    int find = SubstName.Find(FX_BSTRC(","), 0);
    if (find >= 0) {
        family = SubstName.Left(find);
        _PDF_GetStandardFontName(family);
        style = SubstName.Mid(find + 1);
        bHasComma = TRUE;
    } else {
        family = SubstName;
    }
    for (; iBaseFont < 12; iBaseFont ++)
        if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont])) {
            break;
        }
    int PitchFamily = 0;
    FX_BOOL bItalic = FALSE;
    FX_DWORD nStyle = 0;
    FX_BOOL bStyleAvail = FALSE;
    FX_BOOL bFamilyStyleIsWhole = FALSE;
    FX_BOOL bNextF = FALSE;
    if (iBaseFont < 12) {
        family = g_Base14FontNames[iBaseFont];
        if ((iBaseFont % 4) == 1 || (iBaseFont % 4) == 2) {
            nStyle |= FX_FONT_STYLE_Bold;
        }
        if ((iBaseFont % 4) / 2) {
            nStyle |= FX_FONT_STYLE_Italic;
        }
        if (iBaseFont < 4) {
            PitchFamily |= FXFONT_FF_FIXEDPITCH;
        }
        if (iBaseFont >= 8) {
            PitchFamily |= FXFONT_FF_ROMAN;
        }
    } else {
        if (!bHasComma) {
            find = family.ReverseFind('-');
            if (find >= 0) {
                style = family.Mid(find + 1);
                family = family.Left(find);
                bHasHypen = TRUE;
            }
        }
        if (!bHasHypen) {
            int nLen = family.GetLength();
            FX_INT32 nRet = GetStyleType(family, TRUE);
            if (nRet > -1) {
                family = family.Left(nLen - g_FontStyles[nRet].len);
                if (nRet == 0) {
                    nStyle |= FX_FONT_STYLE_Bold;
                }
                if (nRet == 1) {
                    nStyle |= FX_FONT_STYLE_Italic;
                }
                if (nRet == 2) {
                    nStyle |= (FX_FONT_STYLE_Bold | FX_FONT_STYLE_Italic);
//.........这里部分代码省略.........
开发者ID:kakajika,项目名称:loilo-pdf,代码行数:101,代码来源:fx_ge_fontmap.cpp

示例7: ReportFace

void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_DWORD filesize, FX_DWORD offset)
{
    FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
    char buffer[16];
    if (!FXSYS_fread(buffer, 12, 1, pFile)) {
        return;
    }
    FX_DWORD nTables = GET_TT_SHORT(buffer + 4);
    CFX_ByteString tables = _FPDF_ReadStringFromFile(pFile, nTables * 16);
    CFX_ByteString names = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65);
    CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1);
    CFX_ByteString style = _FPDF_GetNameFromTT(names, 2);
    if (style != "Regular") {
        facename += " " + style;
    }
    FX_LPVOID p;
    if (m_FontList.Lookup(facename, p)) {
        return;
    }
    CFontFaceInfo* pInfo = FX_NEW CFontFaceInfo;
    if (!pInfo) {
        return;
    }
    pInfo->m_FilePath = path;
    pInfo->m_FaceName = facename;
    pInfo->m_FontTables = tables;
    pInfo->m_FontOffset = offset;
    pInfo->m_FileSize = filesize;
    pInfo->m_Charsets = 0;
    CFX_ByteString os2 = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32);
    if (os2.GetLength() >= 86) {
        FX_LPCBYTE p = (FX_LPCBYTE)os2 + 78;
        FX_DWORD codepages = GET_TT_LONG(p);
        if (codepages & (1 << 17)) {
            m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET);
            pInfo->m_Charsets |= CHARSET_FLAG_SHIFTJIS;
        }
        if (codepages & (1 << 18)) {
            m_pMapper->AddInstalledFont(facename, FXFONT_GB2312_CHARSET);
            pInfo->m_Charsets |= CHARSET_FLAG_GB;
        }
        if (codepages & (1 << 20)) {
            m_pMapper->AddInstalledFont(facename, FXFONT_CHINESEBIG5_CHARSET);
            pInfo->m_Charsets |= CHARSET_FLAG_BIG5;
        }
        if ((codepages & (1 << 19)) || (codepages & (1 << 21))) {
            m_pMapper->AddInstalledFont(facename, FXFONT_HANGEUL_CHARSET);
            pInfo->m_Charsets |= CHARSET_FLAG_KOREAN;
        }
        if (codepages & (1 << 31)) {
            m_pMapper->AddInstalledFont(facename, FXFONT_SYMBOL_CHARSET);
            pInfo->m_Charsets |= CHARSET_FLAG_SYMBOL;
        }
    }
    m_pMapper->AddInstalledFont(facename, FXFONT_ANSI_CHARSET);
    pInfo->m_Charsets |= CHARSET_FLAG_ANSI;
    pInfo->m_Styles = 0;
    if (style.Find(FX_BSTRC("Bold")) > -1) {
        pInfo->m_Styles |= FXFONT_BOLD;
    }
    if (style.Find(FX_BSTRC("Italic")) > -1 || style.Find(FX_BSTRC("Oblique")) > -1) {
        pInfo->m_Styles |= FXFONT_ITALIC;
    }
    if (facename.Find(FX_BSTRC("Serif")) > -1) {
        pInfo->m_Styles |= FXFONT_SERIF;
    }
    m_FontList.SetAt(facename, pInfo);
}
开发者ID:kakajika,项目名称:loilo-pdf,代码行数:68,代码来源:fx_ge_fontmap.cpp

示例8: FPF_SkiaMaybeArabic

static FX_BOOL FPF_SkiaMaybeArabic(FX_BSTR bsFacename)
{
    CFX_ByteString bsName = bsFacename;
    bsName.MakeLower();
    return bsName.Find("arabic") > -1;
}
开发者ID:BlissRoms,项目名称:platform_external_pdfium,代码行数:6,代码来源:fpf_skiafontmgr.cpp

示例9: FPF_SkiaMaybeSymbol

static FX_BOOL FPF_SkiaMaybeSymbol(FX_BSTR bsFacename)
{
    CFX_ByteString bsName = bsFacename;
    bsName.MakeLower();
    return bsName.Find("symbol") > -1;
}
开发者ID:BlissRoms,项目名称:platform_external_pdfium,代码行数:6,代码来源:fpf_skiafontmgr.cpp

示例10: FindSubstFont

FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
                                        FX_BOOL bTrueType,
                                        uint32_t flags,
                                        int weight,
                                        int italic_angle,
                                        int WindowCP,
                                        CFX_SubstFont* pSubstFont) {
  if (!(flags & FXFONT_USEEXTERNATTR)) {
    weight = FXFONT_FW_NORMAL;
    italic_angle = 0;
  }
  CFX_ByteString SubstName = name;
  SubstName.Remove(' ');
  if (bTrueType && name[0] == '@')
    SubstName = name.Mid(1);
  PDF_GetStandardFontName(&SubstName);
  if (SubstName == "Symbol" && !bTrueType) {
    pSubstFont->m_Family = "Chrome Symbol";
    pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
    pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
    if (m_FoxitFaces[12])
      return m_FoxitFaces[12];
    const uint8_t* pFontData = nullptr;
    uint32_t size = 0;
    m_pFontMgr->GetBuiltinFont(12, &pFontData, &size);
    m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
    return m_FoxitFaces[12];
  }
  if (SubstName == "ZapfDingbats") {
    pSubstFont->m_Family = "Chrome Dingbats";
    pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
    pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
    if (m_FoxitFaces[13])
      return m_FoxitFaces[13];
    const uint8_t* pFontData = nullptr;
    uint32_t size = 0;
    m_pFontMgr->GetBuiltinFont(13, &pFontData, &size);
    m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
    return m_FoxitFaces[13];
  }
  int iBaseFont = 0;
  CFX_ByteString family;
  CFX_ByteString style;
  bool bHasComma = false;
  bool bHasHyphen = false;
  int find = SubstName.Find(",", 0);
  if (find >= 0) {
    family = SubstName.Left(find);
    PDF_GetStandardFontName(&family);
    style = SubstName.Mid(find + 1);
    bHasComma = true;
  } else {
    family = SubstName;
  }
  for (; iBaseFont < kExternalFontIndex; iBaseFont++) {
    if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont]))
      break;
  }
  int PitchFamily = 0;
  bool bItalic = false;
  uint32_t nStyle = 0;
  bool bStyleAvail = false;
  if (iBaseFont < kExternalFontIndex) {
    if ((iBaseFont % 4) == 1 || (iBaseFont % 4) == 2)
      nStyle |= FX_FONT_STYLE_Bold;
    if ((iBaseFont % 4) / 2)
      nStyle |= FX_FONT_STYLE_Italic;
    if (iBaseFont < 4)
      PitchFamily |= FXFONT_FF_FIXEDPITCH;
    if (iBaseFont >= 8)
      PitchFamily |= FXFONT_FF_ROMAN;
  } else {
    if (!bHasComma) {
      find = family.ReverseFind('-');
      if (find >= 0) {
        style = family.Mid(find + 1);
        family = family.Left(find);
        bHasHyphen = true;
      }
    }
    if (!bHasHyphen) {
      int nLen = family.GetLength();
      int32_t nRet = GetStyleType(family, true);
      if (nRet > -1) {
        family = family.Left(nLen - g_FontStyles[nRet].len);
        if (nRet == 0)
          nStyle |= FX_FONT_STYLE_Bold;
        else if (nRet == 1)
          nStyle |= FX_FONT_STYLE_Italic;
        else if (nRet == 2)
          nStyle |= (FX_FONT_STYLE_Bold | FX_FONT_STYLE_Italic);
      }
    }
    UpdatePitchFamily(flags, PitchFamily);
  }
  if (!style.IsEmpty()) {
    int nLen = style.GetLength();
    const FX_CHAR* pStyle = style.c_str();
    int i = 0;
    bool bFirstItem = true;
//.........这里部分代码省略.........
开发者ID:hfiguiere,项目名称:pdfium,代码行数:101,代码来源:cfx_fontmapper.cpp


注:本文中的CFX_ByteString::Find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。