Hi I'm using C++ and have a question regarding the use of fonts in programming.
What I am doing is parsing files like pdf's and other files and wanting to transfer the extracted data to another
file or command line screen. I'm able to work out metrics such as character spacing, x and y coordinates and spaces between words. They're just figures until I can give them some meaning.

If I am to transfer these values to another file which uses a different font then what steps do I need to take into account (how do I go about this).

From what I can gather I should do the below.

1 - determine the font type in the destination file.
2 - Somehow relate the source file metrics to the destination file fonts
3 - work out the new measurements (ie, spaces, x and y coordinates) so the extracted
text can be placed into the destination file.

When parsing PDF files I can use a transformation matrix but can't see how the destination fonts are related to it.

Should I find a font library in C++ and work with the destination fonts that way?
I really have no idea how to make the relationship. Would somebody mind helping me with this in a way
I could understand.

Thanks so much.

2 Years
Discussion Span
Last Post by Rashakil Fol

Was the question too unclear? Could anyone point me in the right direction? I'm lacking knowledge in this area and if anyone can help it would be most appreciated. Thanks guys.


Hi rubberman.. I'm not using a graphics API, I'm trying to transfer text with the correct spacing in a new medium such as a rich text file. Do I need to have a font API or a font engine to do this? I'm tyring to understand the process. Thansk for your patience.


Maybe I have asked the question the wrong way. I now realize that what I am after is Font Metrics of my destination file or output source such as a console.

If I am to translate a space the size of 16 from a PDF file then how does that translate to a space of the same size in my destination file? I assume I would need to somehow extract the font metrix of my destination file or know them beforehand. If that is the case, how do I obtain them beforehand? I'm using C++ if that matters.


It depends on the new file, and how the text layout is defined. Does RTF have a defined algorithm for kerning and paragraph layout? If not, then the behavior is specific to the particular RTF-reading application. If so, then, well, there's a spec somewhere.

In general, how fonts work and how they're sized in different media is specific to those media, there's no general answer to be given here.

Edited by Rashakil Fol

Votes + Comments
1. Đăng ký tài khoản tại các diá»…n đàn sau: Diá»…n đàn Kiếm tiền trên mạng • http://mmo4me.com/forum.php Diá»…n đàn Android •…
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.