summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp2
-rw-r--r--core/fxge/cfx_font.cpp60
-rw-r--r--core/fxge/cfx_font.h4
3 files changed, 33 insertions, 33 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 565886a3a5..b8d1ce2094 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -924,7 +924,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
int italicangle =
pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0;
FX_RECT bbox;
- pFont->GetBBox(bbox);
+ pFont->GetBBox(&bbox);
auto pBBox = pdfium::MakeUnique<CPDF_Array>();
pBBox->AddNew<CPDF_Number>(bbox.left);
pBBox->AddNew<CPDF_Number>(bbox.bottom);
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index ece3f96bed..98322fdf98 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -349,7 +349,7 @@ int CFX_Font::GetDescent() const {
return EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), descender);
}
-bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
+bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT* pBBox) {
if (!m_Face)
return false;
@@ -373,20 +373,20 @@ bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
int pixel_size_x = m_Face->size->metrics.x_ppem,
pixel_size_y = m_Face->size->metrics.y_ppem;
if (pixel_size_x == 0 || pixel_size_y == 0) {
- bbox.left = cbox.xMin;
- bbox.right = cbox.xMax;
- bbox.top = cbox.yMax;
- bbox.bottom = cbox.yMin;
+ pBBox->left = cbox.xMin;
+ pBBox->right = cbox.xMax;
+ pBBox->top = cbox.yMax;
+ pBBox->bottom = cbox.yMin;
} else {
- bbox.left = cbox.xMin * 1000 / pixel_size_x;
- bbox.right = cbox.xMax * 1000 / pixel_size_x;
- bbox.top = cbox.yMax * 1000 / pixel_size_y;
- bbox.bottom = cbox.yMin * 1000 / pixel_size_y;
+ pBBox->left = cbox.xMin * 1000 / pixel_size_x;
+ pBBox->right = cbox.xMax * 1000 / pixel_size_x;
+ pBBox->top = cbox.yMax * 1000 / pixel_size_y;
+ pBBox->bottom = cbox.yMin * 1000 / pixel_size_y;
}
- bbox.top = std::min(bbox.top,
- static_cast<int32_t>(FXFT_Get_Face_Ascender(m_Face)));
- bbox.bottom = std::max(
- bbox.bottom, static_cast<int32_t>(FXFT_Get_Face_Descender(m_Face)));
+ pBBox->top = std::min(pBBox->top,
+ static_cast<int32_t>(FXFT_Get_Face_Ascender(m_Face)));
+ pBBox->bottom = std::max(
+ pBBox->bottom, static_cast<int32_t>(FXFT_Get_Face_Descender(m_Face)));
FT_Done_Glyph(glyph);
return FXFT_Set_Pixel_Sizes(m_Face, 0, 64) == 0;
}
@@ -397,19 +397,19 @@ bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
}
int em = FXFT_Get_Face_UnitsPerEM(m_Face);
if (em == 0) {
- bbox.left = FXFT_Get_Glyph_HoriBearingX(m_Face);
- bbox.bottom = FXFT_Get_Glyph_HoriBearingY(m_Face);
- bbox.top = bbox.bottom - FXFT_Get_Glyph_Height(m_Face);
- bbox.right = bbox.left + FXFT_Get_Glyph_Width(m_Face);
+ pBBox->left = FXFT_Get_Glyph_HoriBearingX(m_Face);
+ pBBox->bottom = FXFT_Get_Glyph_HoriBearingY(m_Face);
+ pBBox->top = pBBox->bottom - FXFT_Get_Glyph_Height(m_Face);
+ pBBox->right = pBBox->left + FXFT_Get_Glyph_Width(m_Face);
} else {
- bbox.left = FXFT_Get_Glyph_HoriBearingX(m_Face) * 1000 / em;
- bbox.top =
+ pBBox->left = FXFT_Get_Glyph_HoriBearingX(m_Face) * 1000 / em;
+ pBBox->top =
(FXFT_Get_Glyph_HoriBearingY(m_Face) - FXFT_Get_Glyph_Height(m_Face)) *
1000 / em;
- bbox.right =
+ pBBox->right =
(FXFT_Get_Glyph_HoriBearingX(m_Face) + FXFT_Get_Glyph_Width(m_Face)) *
1000 / em;
- bbox.bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em;
+ pBBox->bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em;
}
return true;
}
@@ -467,21 +467,21 @@ ByteString CFX_Font::GetFaceName() const {
return m_pSubstFont->m_Family;
}
-bool CFX_Font::GetBBox(FX_RECT& bbox) {
+bool CFX_Font::GetBBox(FX_RECT* pBBox) {
if (!m_Face)
return false;
int em = FXFT_Get_Face_UnitsPerEM(m_Face);
if (em == 0) {
- bbox.left = FXFT_Get_Face_xMin(m_Face);
- bbox.bottom = FXFT_Get_Face_yMax(m_Face);
- bbox.top = FXFT_Get_Face_yMin(m_Face);
- bbox.right = FXFT_Get_Face_xMax(m_Face);
+ pBBox->left = FXFT_Get_Face_xMin(m_Face);
+ pBBox->bottom = FXFT_Get_Face_yMax(m_Face);
+ pBBox->top = FXFT_Get_Face_yMin(m_Face);
+ pBBox->right = FXFT_Get_Face_xMax(m_Face);
} else {
- bbox.left = FXFT_Get_Face_xMin(m_Face) * 1000 / em;
- bbox.top = FXFT_Get_Face_yMin(m_Face) * 1000 / em;
- bbox.right = FXFT_Get_Face_xMax(m_Face) * 1000 / em;
- bbox.bottom = FXFT_Get_Face_yMax(m_Face) * 1000 / em;
+ pBBox->left = FXFT_Get_Face_xMin(m_Face) * 1000 / em;
+ pBBox->top = FXFT_Get_Face_yMin(m_Face) * 1000 / em;
+ pBBox->right = FXFT_Get_Face_xMax(m_Face) * 1000 / em;
+ pBBox->bottom = FXFT_Get_Face_yMax(m_Face) * 1000 / em;
}
return true;
}
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index c753e7e29d..1d17714b46 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -65,7 +65,7 @@ class CFX_Font {
uint32_t GetGlyphWidth(uint32_t glyph_index);
int GetAscent() const;
int GetDescent() const;
- bool GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox);
+ bool GetGlyphBBox(uint32_t glyph_index, FX_RECT* pBBox);
bool IsItalic() const;
bool IsBold() const;
bool IsFixedWidth() const;
@@ -74,7 +74,7 @@ class CFX_Font {
ByteString GetFamilyName() const;
ByteString GetFaceName() const;
bool IsTTFont() const;
- bool GetBBox(FX_RECT& bbox);
+ bool GetBBox(FX_RECT* pBBox);
bool IsEmbedded() const { return m_bEmbedded; }
uint8_t* GetSubData() const { return m_pGsubData.get(); }
void SetSubData(uint8_t* data) { m_pGsubData.reset(data); }