本文整理汇总了C++中CPDF_CIDFont::GetCharSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_CIDFont::GetCharSize方法的具体用法?C++ CPDF_CIDFont::GetCharSize怎么用?C++ CPDF_CIDFont::GetCharSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_CIDFont
的用法示例。
在下文中一共展示了CPDF_CIDFont::GetCharSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcPositionData
void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
FX_FLOAT* pTextAdvanceY,
FX_FLOAT horz_scale,
int level)
{
FX_FLOAT curpos = 0;
FX_FLOAT min_x = 10000 * 1.0f;
FX_FLOAT max_x = -10000 * 1.0f;
FX_FLOAT min_y = 10000 * 1.0f;
FX_FLOAT max_y = -10000 * 1.0f;
CPDF_Font* pFont = m_TextState.GetFont();
FX_BOOL bVertWriting = FALSE;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
}
FX_FLOAT fontsize = m_TextState.GetFontSize();
for (int i = 0; i < m_nChars; ++i) {
FX_DWORD charcode = m_nChars == 1 ?
(FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
if (charcode == (FX_DWORD) - 1) {
curpos -= FXSYS_Mul(m_pCharPos[i - 1], fontsize) / 1000;
continue;
}
if (i) {
m_pCharPos[i - 1] = curpos;
}
FX_RECT char_rect;
pFont->GetCharBBox(charcode, char_rect, level);
FX_FLOAT charwidth;
if (!bVertWriting) {
if (min_y > char_rect.top) {
min_y = (FX_FLOAT)char_rect.top;
}
if (max_y < char_rect.top) {
max_y = (FX_FLOAT)char_rect.top;
}
if (min_y > char_rect.bottom) {
min_y = (FX_FLOAT)char_rect.bottom;
}
if (max_y < char_rect.bottom) {
max_y = (FX_FLOAT)char_rect.bottom;
}
FX_FLOAT char_left = curpos + char_rect.left * fontsize / 1000;
FX_FLOAT char_right = curpos + char_rect.right * fontsize / 1000;
if (min_x > char_left) {
min_x = char_left;
}
if (max_x < char_left) {
max_x = char_left;
}
if (min_x > char_right) {
min_x = char_right;
}
if (max_x < char_right) {
max_x = char_right;
}
charwidth = pFont->GetCharWidthF(charcode, level) * fontsize / 1000;
} else {
FX_WORD CID = pCIDFont->CIDFromCharCode(charcode);
short vx;
short vy;
pCIDFont->GetVertOrigin(CID, vx, vy);
char_rect.left -= vx;
char_rect.right -= vx;
char_rect.top -= vy;
char_rect.bottom -= vy;
if (min_x > char_rect.left) {
min_x = (FX_FLOAT)char_rect.left;
}
if (max_x < char_rect.left) {
max_x = (FX_FLOAT)char_rect.left;
}
if (min_x > char_rect.right) {
min_x = (FX_FLOAT)char_rect.right;
}
if (max_x < char_rect.right) {
max_x = (FX_FLOAT)char_rect.right;
}
FX_FLOAT char_top = curpos + char_rect.top * fontsize / 1000;
FX_FLOAT char_bottom = curpos + char_rect.bottom * fontsize / 1000;
if (min_y > char_top) {
min_y = char_top;
}
if (max_y < char_top) {
max_y = char_top;
}
if (min_y > char_bottom) {
min_y = char_bottom;
}
if (max_y < char_bottom) {
max_y = char_bottom;
}
charwidth = pCIDFont->GetVertWidth(CID) * fontsize / 1000;
}
curpos += charwidth;
if (charcode == ' ' && (!pCIDFont || pCIDFont->GetCharSize(32) == 1)) {
curpos += m_TextState.GetObject()->m_WordSpace;
}
curpos += m_TextState.GetObject()->m_CharSpace;
//.........这里部分代码省略.........