Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Arial Narrow font is not displayed properly
  FAQ FAQ  Forum Search   Register Register  Login Login

Arial Narrow font is not displayed properly

 Post Reply Post Reply
Author
Message
hmofaz@pentagon2000. View Drop Down
Beginner
Beginner


Joined: 04 Oct 10
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote hmofaz@pentagon2000. Quote  Post ReplyReply Direct Link To This Post Topic: Arial Narrow font is not displayed properly
    Posted: 14 Nov 12 at 9:54AM
Hello,
 
The width of text with Arial Narrow font and size 10 is different from the same text displayed in Notepad.
 
see code:

QuickPDF = new PDFLibrary(@dllName)QuickPDF.UnlockKey(LicenseKey);

QuickPDF.SetMeasurementUnits(1);QuickPDF.SetOrigin(1); 

QuickPDF.CompressImages(1);

QuickPDF.SetPageDimensions(215, 279)int fontId = QuickPDF.AddTrueTypeFont("Arial Narrow", 0);

QuickPDF.SelectFont(fontId);

QuickPDF.SetTextColor(0f, 0f, 0f);

QuickPDF.SetTextSize(10);

string printedText = "1ttttttttttttttttttttttttttttt";QuickPDF.DrawText(10, 10, printedText);QuickPDF.CompressContent();                  

QuickPDF.SaveToFile("FontTest.pdf")

 
the width of text with QuickPDF is 25mm but Notepad displays 17mm.
Why there is a difference?

Is any way to draw text with QuickPDF as Notepad?

Thanks

Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 15 Nov 12 at 10:39AM
Here is some test code that I used and the Narrow version of the font is definitely being selected properly.  I assume this is some problem to do with Notepad.

Windows has two different ways of selecting pointsizes as it has two ways of measuring the point size.  Windows can either use the font cell height whereas Adobe fonts are based on the leading value which is based on ascent + descent + leading.

You might be better off comparing 10pt fonts with something like photoshop or a proper drawing package.  Notepad is most likely using the cell height version.

            string printedText = "1ttttttttttttttttttttttttttttt";
            double y = 10;
            int id;

            QP.SetPageDimensions(215, 279);
            QP.SetMeasurementUnits(1);
            QP.SetOrigin(1);

            id = QP.AddTrueTypeFont("Arial Narrow", 0);
            QP.SelectFont(id);
            QP.SetTextSize(10);
            QP.DrawText(10, y, printedText + ":" + QP.FontName());
            y += 6;

            id = QP.AddTrueTypeFont("Arial Narrow", 1);
            QP.SelectFont(id);
            QP.SetTextSize(10);
            QP.DrawText(10, y, printedText + ":" + QP.FontName());
            y += 6;

            id = QP.AddStandardFont(4);      // Arial
            QP.SelectFont(id);
            QP.SetTextSize(10);
            QP.DrawText(10, y, printedText + ":" + QP.FontName());
            y += 6;

            id = QP.AddTrueTypeFont("Arial", 0);
            QP.SelectFont(id);
            QP.SetTextSize(10);
            QP.DrawText(10, y, printedText + ":" + QP.FontName());
            y += 6;

            id = QP.AddTrueTypeFont("Arial", 1);
            QP.SelectFont(id);
            QP.SetTextSize(10);
            QP.DrawText(10, y, printedText + ":" + QP.FontName());
            y += 6;

            QP.SaveToFile("out.pdf");
            Process.Start("out.pdf");

Back to Top
hmofaz@pentagon2000. View Drop Down
Beginner
Beginner


Joined: 04 Oct 10
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote hmofaz@pentagon2000. Quote  Post ReplyReply Direct Link To This Post Posted: 15 Nov 12 at 2:14PM
Hello,
 
I'm comparing to Notepad because we were drawing on Delphi canvas which displays text exactly as Notepad does.
I'm aware that the text shown on QuickPDF is identical to .NET Graphics and MS Word.
What do you mean when you state that the text format shown on PDF is true but shown on Notepad and delphi is old and not correct?
 
Thanks
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 12 at 5:39AM
This is a Microsoft created problem.   QPL will render the same as .NET, postscript, Photoshop etc..  

To calculate the size that you need you will need some type of function to convert from the Microsoft measurement to the Adobe version.  This link below should be helpful

http://stackoverflow.com/questions/2944149/converting-logfont-height-to-font-size-in-points

Andrew.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store