Fix change font

This commit is contained in:
Svetlana Kulikova
2024-10-28 11:55:01 +03:00
parent 8e6e510cd6
commit 04565bbdd4
2 changed files with 15 additions and 19 deletions

View File

@ -2129,17 +2129,16 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
wsFontKey = pPr->GetFontKey();
std::wstring wsFontName = pPr->GetFontName();
if (wsFontName == L"Times-Roman" || wsFontName == L"Times-Bold" || wsFontName == L"Times-BoldItalic" || wsFontName == L"Times-Italic")
wsFontName = L"Times New Roman";
int nStyle = pPr->GetFontStyle();
double dFontSize = pPr->GetFontSizeAP();
put_FontName(wsFontName);
put_FontStyle(nStyle);
put_FontSize(dFontSize);
PdfWriter::CFontTrueType* pFontTT = NULL;
if (nWidgetType != 28 && nWidgetType != 29)
if (nWidgetType == 27)
{
put_FontName(wsFontName);
put_FontStyle(nStyle);
put_FontSize(dFontSize);
if (m_bNeedUpdateTextFont)
UpdateFont();
if (m_pFont)
@ -2401,14 +2400,10 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
pTextWidget->SetMaxLen(pPr->GetMaxLen());
if (nWidgetFlag & (1 << 25))
pTextWidget->SetRV(pPr->GetRV());
bool bAPValue = false;
if (nFlags & (1 << 12))
{
bAPValue = true;
pTextWidget->SetAPV();
PdfWriter::CFontCidTrueType* pWasFont = m_pFont;
LONG nLen = 0;
BYTE* pRender = pPr->GetRender(nLen);
DrawWidgetAP(pAnnot, pRender, nLen);
@ -2416,16 +2411,16 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
PdfWriter::CFontDict* pFont = NULL;
if (m_pFont14)
pFont = m_pFont14;
else if (m_pFont && m_pFont != pWasFont)
else if (m_pFont)
pFont = m_pDocument->CreateTrueTypeFont(m_pFont);
if (pFont)
pWidgetAnnot->SetDA(pFont, oInfo.GetWidgetAnnotPr()->GetFontSize(), dFontSize, oInfo.GetWidgetAnnotPr()->GetTC());
}
// ВНЕШНИЙ ВИД
pTextWidget->SetFont(m_pFont, dFontSize, isBold, isItalic);
if (!bAPValue && bValue && pTextWidget->Get("T"))
else if (bValue && pTextWidget->Get("T"))
{
pTextWidget->SetFont(m_pFont, dFontSize, isBold, isItalic);
DrawTextWidget(pAppFonts, pTextWidget, wsValue);
}
}
else if (oInfo.IsChoiceWidget())
{
@ -3662,10 +3657,11 @@ void CPdfWriter::DrawWidgetAP(PdfWriter::CAnnotation* pA, BYTE* pRender, LONG nL
NSOnlineOfficeBinToPdf::ConvertBufferToRenderer(pRender, nLenRender, pCorrector);
RELEASEOBJECT(pCorrector);
pFakePage->SetStrokeColor(0, 0, 0);
pFakePage->SetFillColor(0, 0, 0);
m_oCommandManager.Flush();
pAP->StartText(NULL, 10);
pAnnot->EndAP();
pAP->EndDraw();
pFakePage->EndMarkedContent();
pAnnot->APFromFakePage(pFakePage);

View File

@ -44,7 +44,7 @@ namespace PdfWriter
"Courier-Bold",
"Courier-Oblique",
"Courier-BoldOblique",
"Times",
"Times-Roman",
"Times-Bold",
"Times-Oblique",
"Times-BoldOblique",