logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ESchunk  
#1 Posted : Wednesday, September 11, 2019 2:36:07 PM(UTC)
ESchunk

Rank: Newbie

Groups: Registered
Joined: 8/13/2019(UTC)
Posts: 6
United States
Location: New York

I have a pdf file with a custom font. The font size when I look in Acrobat is 7.56. The font size returned by PdfTextObject (or Pdfium.FPDFTextObj_GetFontSize) is 1. Is there a way to get the size of a font when the text was created with a custom font?

Attached is a sample PDF with the issue.

Thanks,

Ted test of font.pdf (14kb) downloaded 3 time(s).
Paul Rayman  
#2 Posted : Thursday, September 12, 2019 9:03:54 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 814

Thanks: 1 times
Was thanked: 100 time(s) in 98 post(s)
In fact, in the provided document, the font size is indeed set to 1.
And the size of the text that you see when rendering, appears as a result of applying the transformation matrix.. Examine the textObject.Matrix property. You will find there a scaling factor equal to exactly 7.56.
ESchunk  
#3 Posted : Thursday, September 12, 2019 1:08:46 PM(UTC)
ESchunk

Rank: Newbie

Groups: Registered
Joined: 8/13/2019(UTC)
Posts: 6
United States
Location: New York

Thanks Paul. Can you point me something to learn more about the textObject.Matrix properties. (Not sure what a,b,c...f mean).

I'm trying to get the height of a character given a particular font and font size. My approach is to create a new PdfTextObject using an existing font and text object. For example,

PdfTextObject.Create("A", 1, 1, textObject.Font, textObject.FontSize);

The problem is the font size of the existing object. Should I be using the "D" property of the matrix to get the font size?

Thanks,

Ted
Paul Rayman  
#4 Posted : Saturday, September 14, 2019 11:10:32 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 814

Thanks: 1 times
Was thanked: 100 time(s) in 98 post(s)
Originally Posted by: ESchunk Go to Quoted Post
Thanks Paul. Can you point me something to learn more about the textObject.Matrix properties. (Not sure what a,b,c...f mean).


https://forum.patagames....Matrix-and-How-to-Use-It

Originally Posted by: ESchunk Go to Quoted Post
My approach is to create a new PdfTextObject using an existing font and text object.


You may use original font size and matrix.
Or just call PdfTextObject.Clone();

Edited by user Saturday, September 14, 2019 11:11:05 PM(UTC)  | Reason: Not specified

Users browsing this topic
Similar Topics
Update text field text to reflect Dictionary font size change (Common Questions)
by richard 7/15/2019 4:28:39 AM(UTC)
Font Size Auto Support on Dropdown (Bug Report & Technical Support)
by scott36117 10/5/2018 11:17:50 AM(UTC)
Forum Jump  
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.