本文整理汇总了C++中CFX_AffineMatrix::TransformDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_AffineMatrix::TransformDistance方法的具体用法?C++ CFX_AffineMatrix::TransformDistance怎么用?C++ CFX_AffineMatrix::TransformDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_AffineMatrix
的用法示例。
在下文中一共展示了CFX_AffineMatrix::TransformDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessObject
//.........这里部分代码省略.........
}
}
m_pLastObj = pObj;
int nItems = pObj->CountItems();
FX_FLOAT Ignorekerning = 0;
for(int i = 1; i < nItems - 1; i += 2) {
CPDF_TextObjectItem item;
pObj->GetItemInfo(i, &item);
if (item.m_CharCode == (FX_DWORD) - 1) {
if(i == 1) {
Ignorekerning = item.m_OriginX;
} else if(Ignorekerning > item.m_OriginX) {
Ignorekerning = item.m_OriginX;
}
} else {
Ignorekerning = 0;
break;
}
}
FX_FLOAT spacing = 0;
for (; item_index < nItems; item_index ++) {
CPDF_TextObjectItem item;
pObj->GetItemInfo(item_index, &item);
if (item.m_CharCode == (FX_DWORD) - 1) {
CFX_WideString wstr = m_Buffer.GetWideString();
if (wstr.IsEmpty() || wstr.GetAt(wstr.GetLength() - 1) == L' ') {
continue;
}
FX_FLOAT fontsize_h = pObj->m_TextState.GetFontSizeH();
spacing = -fontsize_h * (item.m_OriginX - Ignorekerning) / 1000;
continue;
}
FX_FLOAT charSpace = pObj->m_TextState.GetObject()->m_CharSpace;
if(nItems > 3 && !spacing) {
charSpace = 0;
}
if((spacing || charSpace) && item_index > 0) {
int last_width = 0;
FX_FLOAT fontsize_h = pObj->m_TextState.GetFontSizeH();
FX_DWORD space_charcode = pFont->CharCodeFromUnicode(' ');
FX_FLOAT threshold = 0;
if (space_charcode != -1) {
threshold = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000 ;
}
if(threshold > fontsize_h / 3) {
threshold = 0;
} else {
threshold /= 2;
}
if (threshold == 0) {
threshold = fontsize_h;
int this_width = FXSYS_abs(GetCharWidth(item.m_CharCode, pFont));
threshold = this_width > last_width ? (FX_FLOAT)this_width : (FX_FLOAT)last_width;
int nDivide = 6;
if (threshold < 300) {
nDivide = 2;
} else if (threshold < 500) {
nDivide = 4;
} else if (threshold < 700) {
nDivide = 5;
}
threshold = threshold / nDivide;
threshold = fontsize_h * threshold / 1000;
}
if(charSpace > 0.001) {
spacing += matrix.TransformDistance(charSpace);
} else if(charSpace < -0.001) {
spacing -= matrix.TransformDistance(FXSYS_fabs(charSpace));
}
if (threshold && (spacing && spacing >= threshold) ) {
m_Buffer.AppendChar(L' ');
if (m_pObjArray) {
m_pObjArray->Add(NULL);
m_pObjArray->Add(NULL);
}
}
if (item.m_CharCode == (FX_DWORD) - 1) {
continue;
}
spacing = 0;
}
CFX_WideString unicode_str = pFont->UnicodeFromCharCode(item.m_CharCode);
if (unicode_str.IsEmpty()) {
m_Buffer.AppendChar((FX_WCHAR)item.m_CharCode);
if (m_pObjArray) {
m_pObjArray->Add((void*)pObj);
m_pObjArray->Add((void*)(FX_INTPTR)item_index);
}
} else {
m_Buffer << unicode_str;
if (m_pObjArray) {
for (int i = 0; i < unicode_str.GetLength(); i ++) {
m_pObjArray->Add((void*)pObj);
m_pObjArray->Add((void*)(FX_INTPTR)item_index);
}
}
}
}
return FALSE;
}