Bug 27197 - fontName in Poppler::TextBox
Summary: fontName in Poppler::TextBox
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: qt4 frontend (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-19 07:17 UTC by couronne
Modified: 2018-08-20 21:33 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description couronne 2010-03-19 07:17:04 UTC
I would like to have the name of the font in Poppler::TextBox
In "QList<TextBox*> Page::textList(Rotation rotate) const" from poppler-page.cc,
it would in fact suffice to take the font of the TextWord when building each TextBox.
Comment 1 Albert Astals Cid 2010-03-20 06:01:23 UTC
What is your use case?

Would you be able to contribute a patch?
Comment 2 couronne 2010-03-22 03:31:20 UTC
(In reply to comment #1)
> What is your use case?
> 
> Would you be able to contribute a patch?
> 

In qt4/src/poppler-page.cc,
  in QList<TextBox*> Page::textList(Rotation rotate) const,
     in for (int i = 0; i < word_list->getLength(); i++) {
       after text_box->m_data->charBBoxes.reserve(word->getLength());
put :
text_box->fontName=QString(word->getFontName()->getCString());

*****************************************
In poppler-qt4.h
  in the TextBox class
add

private:
QString fontName;

public:
QString getFontName();


***************************************

Use Case:

I want to parse scientific pdf articles, and the font would be a useful information.
Comment 3 Albert Astals Cid 2010-04-04 11:31:04 UTC
That patch is obviously a no go for a lot of reasons, moreover if we are going to give that info i'd prefer to return a Poppler::FontInfo instead of a string with the font name. The problem is that extracting this info is a bit slow and the font info is probably not used by lots of people so i wonder if you'd be happy enough if we added a new class TextBoxFont (or something like that) and a new method that returned a list of them in Poppler::Page
Comment 4 couronne 2011-01-26 04:48:18 UTC
(In reply to comment #3)
> That patch is obviously a no go for a lot of reasons, moreover if we are going
> to give that info i'd prefer to return a Poppler::FontInfo instead of a string
> with the font name. The problem is that extracting this info is a bit slow and
> the font info is probably not used by lots of people so i wonder if you'd be
> happy enough if we added a new class TextBoxFont (or something like that) and a
> new method that returned a list of them in Poppler::Page

Yes it would be great having a new class TextBoxFont as you said and the new method returning a list of them. With this feature I would compile my application for Windows :)
Comment 5 Luke-Jr 2015-10-29 23:43:42 UTC
Is there a way to get this information yet? I'd like to detect italic and bold...
Comment 6 GitLab Migration User 2018-08-20 21:33:25 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/8.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.