本文整理汇总了C++中CFX_RectF::Height方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_RectF::Height方法的具体用法?C++ CFX_RectF::Height怎么用?C++ CFX_RectF::Height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_RectF
的用法示例。
在下文中一共展示了CFX_RectF::Height方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDraw
void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) {
if (!m_pRenderDevice || m_ttoLines.empty())
return;
auto pBrush = pdfium::MakeUnique<CFDE_Brush>();
pBrush->SetColor(m_TxtColor);
m_pRenderDevice->SaveState();
if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f)
m_pRenderDevice->SetClipRect(rtClip);
auto pPen = pdfium::MakeUnique<CFDE_Pen>();
pPen->SetColor(m_TxtColor);
for (auto& line : m_ttoLines) {
int32_t iPieces = line.GetSize();
for (int32_t j = 0; j < iPieces; j++) {
FDE_TTOPIECE* pPiece = line.GetPtrAt(j);
if (!pPiece)
continue;
int32_t iCount = GetDisplayPos(pPiece);
if (iCount > 0) {
m_pRenderDevice->DrawString(pBrush.get(), m_pFont, m_CharPos.data(),
iCount, m_fFontSize, &m_Matrix);
}
DrawLine(pPiece, pPen.get());
}
}
m_pRenderDevice->RestoreState();
}
示例2: OnDraw
void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) {
if (!m_pRenderDevice)
return;
int32_t iLines = m_ttoLines.GetSize();
if (iLines < 1)
return;
CFDE_Brush* pBrush = new CFDE_Brush;
pBrush->SetColor(m_TxtColor);
CFDE_Pen* pPen = nullptr;
m_pRenderDevice->SaveState();
if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) {
m_pRenderDevice->SetClipRect(rtClip);
}
for (int32_t i = 0; i < iLines; i++) {
CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i);
int32_t iPieces = pLine->GetSize();
for (int32_t j = 0; j < iPieces; j++) {
FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j);
if (!pPiece)
continue;
int32_t iCount = GetDisplayPos(pPiece);
if (iCount > 0) {
m_pRenderDevice->DrawString(pBrush, m_pFont, m_CharPos.data(), iCount,
m_fFontSize, &m_Matrix);
}
DrawLine(pPiece, pPen);
}
}
m_pRenderDevice->RestoreState();
delete pBrush;
delete pPen;
}
示例3: SetLineWidth
void CFDE_TextOut::SetLineWidth(CFX_RectF& rect) {
if ((m_dwStyles & FDE_TTOSTYLE_SingleLine) == 0) {
FX_FLOAT fLineWidth = 0.0f;
if (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) {
if (rect.Height() < 1.0f) {
rect.height = m_fFontSize * 1000.0f;
}
fLineWidth = rect.Height();
} else {
if (rect.Width() < 1.0f) {
rect.width = m_fFontSize * 1000.0f;
}
fLineWidth = rect.Width();
}
m_pTxtBreak->SetLineWidth(fLineWidth);
}
}
示例4: CalcLogicSize
void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
int32_t iLength,
CFX_SizeF& size) {
CFX_RectF rtText;
rtText.Set(0.0f, 0.0f, size.x, size.y);
CalcLogicSize(pwsStr, iLength, rtText);
size.x = rtText.Width();
size.y = rtText.Height();
}
示例5: CalcSize
void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr,
int32_t iLength,
CFX_Size& size) {
CFX_RectF rtText;
rtText.Set(0.0f, 0.0f, (FX_FLOAT)size.x, (FX_FLOAT)size.y);
CalcSize(pwsStr, iLength, rtText);
size.x = (int32_t)rtText.Width();
size.y = (int32_t)rtText.Height();
}
示例6: CalcWidgetHeigt
void CFWL_GridImp::CalcWidgetHeigt(IFWL_Widget* pWidget,
CFWL_GridWidgetInfo* pInfo,
FX_FLOAT fRowHeigt) {
if (pInfo->m_Size[FWL_GRIDSIZE_Height].eUnit == FWL_GRIDUNIT_Fixed) {
SetWidgetActualHeight(pInfo, pInfo->m_Size[FWL_GRIDSIZE_Height].fLength);
} else {
FX_FLOAT fHeight = 0;
FX_FLOAT fTopMargin = 0, fBottomMargin = 0;
FX_BOOL bTopMargin =
GetWidgetMargin(pWidget, FWL_GRIDMARGIN_Top, fTopMargin);
FX_BOOL bBottomMargin =
GetWidgetMargin(pWidget, FWL_GRIDMARGIN_Bottom, fBottomMargin);
if (bTopMargin && bBottomMargin) {
fHeight = fRowHeigt - fTopMargin - fBottomMargin;
} else {
CFX_RectF rtAuto;
pWidget->GetWidgetRect(rtAuto, TRUE);
fHeight = rtAuto.Height();
}
SetWidgetActualHeight(pInfo, fHeight);
}
}
示例7: RetriecePieces
FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus,
int32_t& iStartChar,
int32_t& iPieceWidths,
FX_BOOL bReload,
const CFX_RectF& rect) {
FX_BOOL bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine);
FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
FX_FLOAT fLineStep =
(m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
if (bVertical) {
fLineStep = -fLineStep;
}
CFX_Char* pTC = nullptr;
FX_BOOL bNeedReload = FALSE;
FX_FLOAT fLineWidth = bVertical ? rect.Height() : rect.Width();
int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
int32_t iCount = m_pTxtBreak->CountBreakPieces();
for (int32_t i = 0; i < iCount; i++) {
const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
int32_t iPieceChars = pPiece->GetLength();
int32_t iChar = iStartChar;
int32_t iWidth = 0;
int32_t j = 0;
for (; j < iPieceChars; j++) {
pTC = pPiece->GetCharPtr(j);
int32_t iCurCharWidth = pTC->m_iCharWidth > 0 ? pTC->m_iCharWidth : 0;
if (bSingleLine || !bLineWrap) {
if (iLineWidth - iPieceWidths - iWidth < iCurCharWidth) {
bNeedReload = TRUE;
break;
}
}
iWidth += iCurCharWidth;
m_CharWidths[iChar++] = iCurCharWidth;
}
if (j == 0 && !bReload) {
CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(m_iCurLine);
pLine->m_bNewReload = TRUE;
} else if (j > 0) {
CFX_RectF rtPiece;
if (bVertical) {
rtPiece.left = m_fLinePos;
rtPiece.top = rect.top + (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
rtPiece.width = fLineStep;
rtPiece.height = iWidth / 20000.0f;
} else {
rtPiece.left = rect.left + (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
rtPiece.top = m_fLinePos;
rtPiece.width = iWidth / 20000.0f;
rtPiece.height = fLineStep;
}
FDE_TTOPIECE ttoPiece;
ttoPiece.iStartChar = iStartChar;
ttoPiece.iChars = j;
ttoPiece.rtPiece = rtPiece;
ttoPiece.dwCharStyles = pPiece->m_dwCharStyles;
if (FX_IsOdd(pPiece->m_iBidiLevel)) {
ttoPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel;
}
AppendPiece(ttoPiece, bNeedReload, (bReload && i == iCount - 1));
}
iStartChar += iPieceChars;
iPieceWidths += iWidth;
}
m_pTxtBreak->ClearBreakPieces();
FX_BOOL bRet = bSingleLine || bLineWrap || (!bLineWrap && bNeedReload) ||
dwBreakStatus == FX_TXTBREAK_ParagraphBreak;
return bRet;
}
示例8: CalcTextSize
void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
int32_t iLength,
CFX_RectF& rect) {
ASSERT(m_pFont && m_fFontSize >= 1.0f);
SetLineWidth(rect);
m_iTotalLines = 0;
const FX_WCHAR* pStr = pwsStr;
FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
FX_FLOAT fWidth = 0.0f;
FX_FLOAT fHeight = 0.0f;
FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right();
uint32_t dwBreakStatus = 0;
FX_WCHAR wPreChar = 0;
FX_WCHAR wch;
FX_WCHAR wBreak = 0;
while (iLength-- > 0) {
wch = *pStr++;
if (wBreak == 0 && (wch == L'\n' || wch == L'\r')) {
wBreak = wch;
m_pTxtBreak->SetParagraphBreakChar(wch);
}
if (bHotKey && wch == L'&' && wPreChar != L'&') {
wPreChar = wch;
continue;
}
dwBreakStatus = m_pTxtBreak->AppendChar(wch);
if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
}
wPreChar = 0;
}
dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
}
m_pTxtBreak->Reset();
FX_FLOAT fInc = rect.Height() - fHeight;
if (bVertical) {
fInc = rect.Width() - fHeight;
}
if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft &&
m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) {
fInc /= 2.0f;
} else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) {
fInc = 0.0f;
}
if (bVertical) {
rect.top += fStartPos;
rect.left += fInc;
rect.width = fHeight;
rect.height = std::min(fWidth, rect.Height());
} else {
rect.left += fStartPos;
rect.top += fInc;
rect.width = std::min(fWidth, rect.Width());
rect.height = fHeight;
if (m_dwStyles & FDE_TTOSTYLE_LastLineHeight) {
rect.height -= m_fLineSpace - m_fFontSize;
}
}
}
示例9: CapPlacement
void CXFA_FFField::CapPlacement() {
CFX_RectF rtWidget;
GetRectWithoutRotate(rtWidget);
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
if (mgWidget) {
CXFA_LayoutItem* pItem = this;
FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
mgWidget.GetLeftInset(fLeftInset);
mgWidget.GetRightInset(fRightInset);
mgWidget.GetTopInset(fTopInset);
mgWidget.GetBottomInset(fBottomInset);
if (!pItem->GetPrev() && !pItem->GetNext()) {
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
} else {
if (!pItem->GetPrev()) {
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, 0);
} else if (!pItem->GetNext()) {
rtWidget.Deflate(fLeftInset, 0, fRightInset, fBottomInset);
} else {
rtWidget.Deflate(fLeftInset, 0, fRightInset, 0);
}
}
}
XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
FX_FLOAT fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && GetPrev()) {
m_rtCaption.Set(0, 0, 0, 0);
} else if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom && GetNext()) {
m_rtCaption.Set(0, 0, 0, 0);
} else {
fCapReserve = caption.GetReserve();
CXFA_LayoutItem* pItem = this;
if (!pItem->GetPrev() && !pItem->GetNext()) {
m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width,
rtWidget.height);
} else {
pItem = pItem->GetFirst();
pItem->GetRect(m_rtCaption);
pItem = pItem->GetNext();
while (pItem) {
CFX_RectF rtRect;
pItem->GetRect(rtRect);
m_rtCaption.height += rtRect.Height();
pItem = pItem->GetNext();
}
XFA_RectWidthoutMargin(m_rtCaption, mgWidget);
}
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
if (fCapReserve <= 0 && pCapTextLayout) {
CFX_SizeF size;
CFX_SizeF minSize;
CFX_SizeF maxSize;
pCapTextLayout->CalcSize(minSize, maxSize, size);
if (iCapPlacement == XFA_ATTRIBUTEENUM_Top ||
iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) {
fCapReserve = size.y;
} else {
fCapReserve = size.x;
}
}
}
}
m_rtUI = rtWidget;
switch (iCapPlacement) {
case XFA_ATTRIBUTEENUM_Left: {
m_rtCaption.width = fCapReserve;
CapLeftRightPlacement(caption, rtWidget, iCapPlacement);
m_rtUI.width -= fCapReserve;
m_rtUI.left += fCapReserve;
} break;
case XFA_ATTRIBUTEENUM_Top: {
m_rtCaption.height = fCapReserve;
CapTopBottomPlacement(caption, rtWidget, iCapPlacement);
m_rtUI.top += fCapReserve;
m_rtUI.height -= fCapReserve;
} break;
case XFA_ATTRIBUTEENUM_Right: {
m_rtCaption.left = m_rtCaption.right() - fCapReserve;
m_rtCaption.width = fCapReserve;
CapLeftRightPlacement(caption, rtWidget, iCapPlacement);
m_rtUI.width -= fCapReserve;
} break;
case XFA_ATTRIBUTEENUM_Bottom: {
m_rtCaption.top = m_rtCaption.bottom() - fCapReserve;
m_rtCaption.height = fCapReserve;
CapTopBottomPlacement(caption, rtWidget, iCapPlacement);
m_rtUI.height -= fCapReserve;
} break;
case XFA_ATTRIBUTEENUM_Inline:
break;
default:
break;
}
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
if (borderUI) {
CXFA_Margin margin = borderUI.GetMargin();
if (margin) {
//.........这里部分代码省略.........