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!
![]() |
Arial Narrow font is not displayed properly |
Post Reply ![]() |
Author | |
hmofaz@pentagon2000. ![]() Beginner ![]() Joined: 04 Oct 10 Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() 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") Is any way to draw text with QuickPDF as Notepad?
|
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
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"); |
|
![]() |
|
hmofaz@pentagon2000. ![]() Beginner ![]() Joined: 04 Oct 10 Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store