pdf-reader icon indicating copy to clipboard operation
pdf-reader copied to clipboard

Parse font of given text

Open chrismv48 opened this issue 7 years ago • 1 comments

Maybe I'm being dense, but I don't see an obvious way to map fonts onto the text they apply to. I see the fonts method, but it seems to just list the fonts found on the page, but not what parts of the page they come from? Am I missing something?

chrismv48 avatar Feb 03 '18 22:02 chrismv48

From looking at the code, that looks to be correct.

The text is put into TextRun objects within a PageLayout, but these are only initialized with and store x, y, width, font_size and the text. Additionally, when you ask for the page text it merges the TextRuns together into a single text string, so you don't see them individually in any case. It would be possible to associate the fonts with each text segment, but only if you modify the gem code.

rockorequin avatar Mar 26 '19 02:03 rockorequin