summaryrefslogtreecommitdiff
path: root/core/src/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge')
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.cpp6
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp17
-rw-r--r--core/src/fxge/ge/fx_ge_ps.cpp158
3 files changed, 81 insertions, 100 deletions
diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp
index a263416521..254f806fec 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/src/fxge/android/fpf_skiafontmgr.cpp
@@ -247,7 +247,7 @@ void CFPF_SkiaFontMgr::LoadSystemFonts() {
if (m_bLoaded) {
return;
}
- ScanPath(FX_BSTRC("/system/fonts"));
+ ScanPath("/system/fonts");
OutputSystemFonts();
m_bLoaded = TRUE;
}
@@ -416,13 +416,13 @@ void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteStringC& path) {
FX_BOOL bFolder = FALSE;
while (FX_GetNextFile(handle, filename, bFolder)) {
if (bFolder) {
- if (filename == FX_BSTRC(".") || filename == FX_BSTRC("..")) {
+ if (filename == "." || filename == "..") {
continue;
}
} else {
CFX_ByteString ext = filename.Right(4);
ext.MakeLower();
- if (ext != FX_BSTRC(".ttf") && ext != FX_BSTRC(".ttc")) {
+ if (ext != ".ttf" && ext != ".ttc" && ext != ".otf") {
continue;
}
}
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index ecec77f2ce..dfd6704fe1 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -362,7 +362,7 @@ int32_t GetStyleType(const CFX_ByteString& bsStyle, FX_BOOL bRevert) {
}
FX_BOOL CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) {
- if (name == FX_BSTRC("MyriadPro")) {
+ if (name == "MyriadPro") {
PitchFamily &= ~FXFONT_FF_ROMAN;
return TRUE;
}
@@ -854,7 +854,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
}
}
PDF_GetStandardFontName(&SubstName);
- if (SubstName == FX_BSTRC("Symbol") && !bTrueType) {
+ if (SubstName == "Symbol" && !bTrueType) {
pSubstFont->m_Family = "Chrome Symbol";
pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
@@ -867,7 +867,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
return m_FoxitFaces[12];
}
- if (SubstName == FX_BSTRC("ZapfDingbats")) {
+ if (SubstName == "ZapfDingbats") {
pSubstFont->m_Family = "Chrome Dingbats";
pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
@@ -884,7 +884,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
CFX_ByteString family, style;
FX_BOOL bHasComma = FALSE;
FX_BOOL bHasHypen = FALSE;
- int find = SubstName.Find(FX_BSTRC(","), 0);
+ int find = SubstName.Find(",", 0);
if (find >= 0) {
family = SubstName.Left(find);
PDF_GetStandardFontName(&family);
@@ -1112,7 +1112,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (Charset == FXFONT_SYMBOL_CHARSET) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
- if (SubstName == FX_BSTRC("Symbol")) {
+ if (SubstName == "Symbol") {
pSubstFont->m_Family = "Chrome Symbol";
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
@@ -1462,14 +1462,13 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path,
m_pMapper->AddInstalledFont(facename, FXFONT_ANSI_CHARSET);
pInfo->m_Charsets |= CHARSET_FLAG_ANSI;
pInfo->m_Styles = 0;
- if (style.Find(FX_BSTRC("Bold")) > -1) {
+ if (style.Find("Bold") > -1) {
pInfo->m_Styles |= FXFONT_BOLD;
}
- if (style.Find(FX_BSTRC("Italic")) > -1 ||
- style.Find(FX_BSTRC("Oblique")) > -1) {
+ if (style.Find("Italic") > -1 || style.Find("Oblique") > -1) {
pInfo->m_Styles |= FXFONT_ITALIC;
}
- if (facename.Find(FX_BSTRC("Serif")) > -1) {
+ if (facename.Find("Serif") > -1) {
pInfo->m_Styles |= FXFONT_SERIF;
}
m_FontList[facename] = pInfo;
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index bf0c8c1a16..6ce8f4635b 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -101,16 +101,16 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
if (pObject2Device) {
pObject2Device->Transform(x, y);
}
- buf << x << FX_BSTRC(" ") << y;
+ buf << x << " " << y;
switch (flag & FXPT_TYPE) {
case FXPT_MOVETO:
- buf << FX_BSTRC(" m ");
+ buf << " m ";
break;
case FXPT_LINETO:
if (flag & FXPT_CLOSEFIGURE) {
- buf << FX_BSTRC(" l h ");
+ buf << " l h ";
} else {
- buf << FX_BSTRC(" l ");
+ buf << " l ";
}
break;
case FXPT_BEZIERTO: {
@@ -122,12 +122,11 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
pObject2Device->Transform(x1, y1);
pObject2Device->Transform(x2, y2);
}
- buf << FX_BSTRC(" ") << x1 << FX_BSTRC(" ") << y1 << FX_BSTRC(" ") << x2
- << FX_BSTRC(" ") << y2;
+ buf << " " << x1 << " " << y1 << " " << x2 << " " << y2;
if (flag & FXPT_CLOSEFIGURE) {
- buf << FX_BSTRC(" c h\n");
+ buf << " c h\n";
} else {
- buf << FX_BSTRC(" c\n");
+ buf << " c\n";
}
i += 2;
break;
@@ -159,11 +158,9 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData,
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ")
- << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f
- << FX_BSTRC("]cm ");
+ buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm ";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
OutputPath(pPathData, NULL);
@@ -205,11 +202,9 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData,
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ")
- << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f
- << FX_BSTRC("]cm ");
+ buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm ";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
}
@@ -245,29 +240,29 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) {
CFX_ByteTextBuf buf;
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineCap != pGraphState->m_LineCap) {
- buf << pGraphState->m_LineCap << FX_BSTRC(" J\n");
+ buf << pGraphState->m_LineCap << " J\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_DashCount != pGraphState->m_DashCount ||
FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray,
sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) {
- buf << FX_BSTRC("[");
+ buf << "[";
for (int i = 0; i < pGraphState->m_DashCount; i++) {
- buf << pGraphState->m_DashArray[i] << FX_BSTRC(" ");
+ buf << pGraphState->m_DashArray[i] << " ";
}
- buf << FX_BSTRC("]") << pGraphState->m_DashPhase << FX_BSTRC(" d\n");
+ buf << "]" << pGraphState->m_DashPhase << " d\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineJoin != pGraphState->m_LineJoin) {
- buf << pGraphState->m_LineJoin << FX_BSTRC(" j\n");
+ buf << pGraphState->m_LineJoin << " j\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineWidth != pGraphState->m_LineWidth) {
- buf << pGraphState->m_LineWidth << FX_BSTRC(" w\n");
+ buf << pGraphState->m_LineWidth << " w\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_MiterLimit != pGraphState->m_MiterLimit) {
- buf << pGraphState->m_MiterLimit << FX_BSTRC(" M\n");
+ buf << pGraphState->m_MiterLimit << " M\n";
}
m_CurGraphState.Copy(*pGraphState);
m_bGraphStateSet = TRUE;
@@ -374,13 +369,11 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
}
OUTPUT_PS("q\n");
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("[") << pMatrix->a << FX_BSTRC(" ") << pMatrix->b
- << FX_BSTRC(" ") << pMatrix->c << FX_BSTRC(" ") << pMatrix->d
- << FX_BSTRC(" ") << pMatrix->e << FX_BSTRC(" ") << pMatrix->f
- << FX_BSTRC("]cm ");
+ buf << "[" << pMatrix->a << " " << pMatrix->b << " " << pMatrix->c << " "
+ << pMatrix->d << " " << pMatrix->e << " " << pMatrix->f << "]cm ";
int width = pSource->GetWidth();
int height = pSource->GetHeight();
- buf << width << FX_BSTRC(" ") << height;
+ buf << width << " " << height;
if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) {
int pitch = (width + 7) / 8;
FX_DWORD src_size = height * pitch;
@@ -395,20 +388,19 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
if (pSource->IsAlphaMask()) {
SetColor(color, alpha_flag, pIccTransform);
m_bColorSet = FALSE;
- buf << FX_BSTRC(" true[");
+ buf << " true[";
} else {
- buf << FX_BSTRC(" 1[");
+ buf << " 1[";
}
- buf << width << FX_BSTRC(" 0 0 -") << height << FX_BSTRC(" 0 ") << height
- << FX_BSTRC("]currentfile/ASCII85Decode filter ");
+ buf << width << " 0 0 -" << height << " 0 " << height
+ << "]currentfile/ASCII85Decode filter ";
if (output_buf != src_buf)
- buf << FX_BSTRC("<</K -1/EndOfBlock false/Columns ") << width
- << FX_BSTRC("/Rows ") << height
- << FX_BSTRC(">>/CCITTFaxDecode filter ");
+ buf << "<</K -1/EndOfBlock false/Columns " << width << "/Rows " << height
+ << ">>/CCITTFaxDecode filter ";
if (pSource->IsAlphaMask()) {
- buf << FX_BSTRC("iM\n");
+ buf << "iM\n";
} else {
- buf << FX_BSTRC("false 1 colorimage\n");
+ buf << "false 1 colorimage\n";
}
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf, output_size);
@@ -489,15 +481,14 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
delete pConverted;
pConverted = NULL;
}
- buf << FX_BSTRC(" 8[");
- buf << width << FX_BSTRC(" 0 0 -") << height << FX_BSTRC(" 0 ") << height
- << FX_BSTRC("]");
- buf << FX_BSTRC("currentfile/ASCII85Decode filter ");
+ buf << " 8[";
+ buf << width << " 0 0 -" << height << " 0 " << height << "]";
+ buf << "currentfile/ASCII85Decode filter ";
if (filter) {
buf << filter;
}
- buf << FX_BSTRC("false ") << Bpp;
- buf << FX_BSTRC(" colorimage\n");
+ buf << "false " << Bpp;
+ buf << " colorimage\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf, output_size);
FX_Free(output_buf);
@@ -528,13 +519,13 @@ void CFX_PSRenderer::SetColor(FX_DWORD color,
if (bCMYK != m_bCmykOutput || !m_bColorSet || m_LastColor != color) {
CFX_ByteTextBuf buf;
if (bCMYK) {
- buf << FXSYS_GetCValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetMValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetYValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetKValue(color) / 255.0 << FX_BSTRC(" k\n");
+ buf << FXSYS_GetCValue(color) / 255.0 << " "
+ << FXSYS_GetMValue(color) / 255.0 << " "
+ << FXSYS_GetYValue(color) / 255.0 << " "
+ << FXSYS_GetKValue(color) / 255.0 << " k\n";
} else {
- buf << FXARGB_R(color) / 255.0 << FX_BSTRC(" ") << FXARGB_G(color) / 255.0
- << FX_BSTRC(" ") << FXARGB_B(color) / 255.0 << FX_BSTRC(" rg\n");
+ buf << FXARGB_R(color) / 255.0 << " " << FXARGB_G(color) / 255.0 << " "
+ << FXARGB_B(color) / 255.0 << " rg\n";
}
if (bCMYK == m_bCmykOutput) {
m_bColorSet = TRUE;
@@ -575,18 +566,16 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
pPSFont->m_nGlyphs = 0;
m_PSFontList.Add(pPSFont);
CFX_ByteTextBuf buf;
- buf << FX_BSTRC(
- "8 dict begin/FontType 3 def/FontMatrix[1 0 0 1 0 0]def\n"
- "/FontBBox[0 0 0 0]def/Encoding 256 array def 0 1 255{Encoding "
- "exch/.notdef put}for\n"
- "/CharProcs 1 dict def CharProcs begin/.notdef {} def end\n"
- "/BuildGlyph{1 0 -10 -10 10 10 setcachedevice exch/CharProcs get exch "
- "2 copy known not{pop/.notdef}if get exec}bind def\n"
- "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get "
- "exec}bind def\n"
- "currentdict end\n");
- buf << FX_BSTRC("/X") << m_PSFontList.GetSize() - 1
- << FX_BSTRC(" exch definefont pop\n");
+ buf << "8 dict begin/FontType 3 def/FontMatrix[1 0 0 1 0 0]def\n"
+ "/FontBBox[0 0 0 0]def/Encoding 256 array def 0 1 255{Encoding "
+ "exch/.notdef put}for\n"
+ "/CharProcs 1 dict def CharProcs begin/.notdef {} def end\n"
+ "/BuildGlyph{1 0 -10 -10 10 10 setcachedevice exch/CharProcs get "
+ "exch 2 copy known not{pop/.notdef}if get exec}bind def\n"
+ "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get "
+ "exec}bind def\n"
+ "currentdict end\n";
+ buf << "/X" << m_PSFontList.GetSize() - 1 << " exch definefont pop\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
buf.Clear();
}
@@ -622,35 +611,32 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
TransformedPath.Transform(&matrix);
}
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/CharProcs get begin/")
- << ps_glyphindex << FX_BSTRC("{");
- buf << FX_BSTRC("n ");
+ buf << "/X" << ps_fontnum << " Ff/CharProcs get begin/" << ps_glyphindex
+ << "{n ";
for (int p = 0; p < TransformedPath.GetPointCount(); p++) {
FX_FLOAT x = TransformedPath.GetPointX(p), y = TransformedPath.GetPointY(p);
switch (TransformedPath.GetFlag(p) & FXPT_TYPE) {
case FXPT_MOVETO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" m\n");
+ buf << x << " " << y << " m\n";
break;
}
case FXPT_LINETO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" l\n");
+ buf << x << " " << y << " l\n";
break;
}
case FXPT_BEZIERTO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" ")
- << TransformedPath.GetPointX(p + 1) << FX_BSTRC(" ")
- << TransformedPath.GetPointY(p + 1) << FX_BSTRC(" ")
- << TransformedPath.GetPointX(p + 2) << FX_BSTRC(" ")
- << TransformedPath.GetPointY(p + 2) << FX_BSTRC(" c\n");
+ buf << x << " " << y << " " << TransformedPath.GetPointX(p + 1) << " "
+ << TransformedPath.GetPointY(p + 1) << " "
+ << TransformedPath.GetPointX(p + 2) << " "
+ << TransformedPath.GetPointY(p + 2) << " c\n";
p += 2;
break;
}
}
}
- buf << FX_BSTRC("f");
- buf << FX_BSTRC("}bind def end\n");
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/Encoding get ")
- << ps_glyphindex << FX_BSTRC("/") << ps_glyphindex << FX_BSTRC(" put\n");
+ buf << "f}bind def end\n";
+ buf << "/X" << ps_fontnum << " Ff/Encoding get " << ps_glyphindex << "/"
+ << ps_glyphindex << " put\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
FX_BOOL CFX_PSRenderer::DrawText(int nChars,
@@ -674,11 +660,9 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
}
SetColor(color, alpha_flag, pIccTransform);
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("q[") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d;
- buf << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ")
- << pObject2Device->f << "]cm\n";
+ buf << "q[" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm\n";
if (pCache == NULL) {
pCache = CFX_GEModule::Get()->GetFontCache();
}
@@ -689,17 +673,15 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
int ps_fontnum, ps_glyphindex;
FindPSFontGlyph(pFaceCache, pFont, pCharPos[i], ps_fontnum, ps_glyphindex);
if (last_fontnum != ps_fontnum) {
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff ") << font_size
- << FX_BSTRC(" Fs Sf ");
+ buf << "/X" << ps_fontnum << " Ff " << font_size << " Fs Sf ";
last_fontnum = ps_fontnum;
}
- buf << pCharPos[i].m_OriginX << FX_BSTRC(" ") << pCharPos[i].m_OriginY
- << FX_BSTRC(" m");
+ buf << pCharPos[i].m_OriginX << " " << pCharPos[i].m_OriginY << " m";
CFX_ByteString hex;
hex.Format("<%02X>", ps_glyphindex);
- buf << hex << FX_BSTRC("Tj\n");
+ buf << hex << "Tj\n";
}
- buf << FX_BSTRC("Q\n");
+ buf << "Q\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
return TRUE;
}