Hi Christian,

I'm sorry: I won't do any support for the 0.9.x series. You have been
subscribed to the mailing list for a long time: you certainly know that we
had 0.10.x and we now have a 1.0.x series (soon there will be also a
1.1.x). You should stop living in the past and upgrade, because it brings
you real value. This is how you do it with the 1.x stable API:

    PdfMemDocument doc;
    auto& font =
doc.GetFonts().GetOrCreateFont(R"(D:\haborocontrastnormregular.otf)");
    auto& page = doc.GetPages().CreatePage();
    {
        PdfPainter painter;
        painter.SetCanvas(page);
        painter.TextState.SetFont(font, 18);
        painter.DrawText("ABCDEFGHIKLMNOPQRSTVXYZ", 50, 700);
    }
    doc.Save(R"(D:\font-text-drawing.pdf)");

You don't have to deal with encodings: everything is handled automatically,
with full unicode support. Requirement for manual handling of encodings in
pre 0.10.x PoDoFo versions was probably the result of lack of time to
implement features that turned out to be much more complex than they
appeared to be. Attached is the result of the above code and, surprise, no
glitches. Not everything is perfect, because we still don't have proper
text shaping[1], which is not relevant only for bidi languages but for
proper latin scripts kerning as well. In the past I received private
comments who stated that text writing in PoDoFo is a toy because of such a
lack, and adding HarfBuzz support was easy: well, I'm still waiting for
their patches to close the gap.

Regards,
Francesco

[1] https://github.com/podofo/podofo/issues/297


On Mon, 8 Dec 2025 at 08:30, Christian Sakowski <
[email protected]> wrote:

> Hi,
>
> i identified the problem.
>
> When using GlobalPdfDocEncodingInstance() it works correctly, but NOT with
> GlobalIdentityEncodingInstance()! I Used this because the docs say: "useful
> for writing direct UTF8 strings“!
>
>    //EXAMPLE
>
> PoDoFo::PdfMemDocument  writer;
> PoDoFo::PdfPage* pPage =
> writer.CreatePage(PoDoFo::PdfPage::CreateStandardPageSize(PoDoFo::ePdfPageSize_A4));
> PoDoFo::PdfPainter ppainter;
> const PoDoFo::PdfEncoding* encFac;
>
> encFac = PoDoFo::PdfEncodingFactory::GlobalIdentityEncodingInstance();
>
> ppainter.SetPage(pPage);
>
> PoDoFo::PdfFont* pFont = NULL;
> try {
> pFont = writer.CreateFont("HaboroContrast-NorReg", false, false, false,
> encFac, PoDoFo::PdfFontCache::eFontCreationFlags_AutoSelectBase14, true);
> }
> catch (PoDoFo::PdfError& e) {
> pFont = writer.CreateFont("Arial",
> PoDoFo::PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), false);
> }
> if (!pFont)
> {
> PODOFO_RAISE_ERROR(PoDoFo::ePdfError_InvalidHandle);
> }
>
> pFont->SetFontSize(16.0);
> ppainter.SetFont(pFont);
> ppainter.DrawText(100, 100, "ABC");
> ppainter.FinishPage();
>
> writer.Write("C:\\Users\\christian\\Desktop\\podofo.pdf“);
>
> I am using v0.9.6
> --
>
> Grüße/Regards,
> [heubach-media] | Christian Sakowski
> [email protected]
> Tel: +49/(0)40/52 10 59-23
>
>
>
>
> > Am 04.12.2025 um 10:29 schrieb Francesco Pretto <[email protected]>:
> >
> > Hello,
> >
> > please: attach a self compilable code which shows the problem and report
> the PoDoFo version.
> >
> > Francesco
> >
> > On Thu, 4 Dec 2025 at 09:38, Christian Sakowski <
> [email protected]> wrote:
> > Hi,
> >
> > i have created a simple output with the letter „A“ and the font
> "haboro-contrast-normal-medium.otf“.
> > But in PoDoFo there is a space after the letter „A“, when creating an
> output with MS Print To PDF, there is no such space.
> > See attachments.
> > Any hint where to find a solution?
> > Many thanks!
> >
>
>
>
> ---
> heubach media
> Osterfeldstr. 12-14 | Haus 1 | Eingang Nord
> 22529 Hamburg
> tel: 040 / 52 10 59 - 10 | fax: -99
> mail: [email protected]
> home: www.heubach-media.de
> Geschäftsführer|CEO: Matthias Heubach
>
> Mieten Sie Ihre Computer, iPads & Drucker für Ihre Events bei:
> http://www.milo-rental.com
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen.
> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich
> erhalten haben, informieren Sie bitte sofort den Absender
> und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
> die unbefugte Weitergabe dieser Mail ist nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information.
> If you are not the intended recipient (or have received this e-mail in
> error)
> please notify the sender immediately and destroy this e-mail.
> Any unauthorized copying, disclosure or distribution of the
> material in this e-mail is strictly forbidden.
>
>

Attachment: font-text-drawing.pdf
Description: Adobe PDF document

_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to