pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Murray-Rust <pm...@cam.ac.uk>
Subject Re: Determining whether character/font is bold
Date Mon, 13 May 2013 17:44:34 GMT
Thanks for answering - any help is valuable.

On Mon, May 13, 2013 at 6:02 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>wrote:

> Hi Peter,
> I don't think that it's possible to say that a font is bold wo the
> description of saying so. You could compare some of the characteristics of
> a glyph to make a decision e.g. if you have similar fonts. I'm not the
> expert on fonts though so maybe others are better suited to give a trustful
> answer.

I understand the logic. Where a font has a fontWeight then there is a
heuristic cutoff - PDFBox itself quotes:

/**         * The weight of the font.  According to the PDF spec "possible
values are
         * 100, 200, 300, 400, 500, 600, 700, 800 or 900"  Where a higher
number is
         * more weight and appears to be more bold. */

I have found in one case that setting fontWeight to 410 was useful.

I assume the fontWeight must do something! Does it create the font-fill in
a grey scale (or colour scale)? Or does it fill in the font with lines?

Eliot Kimber:

 >>> You would expect to see something in the font name that indicates
like "bold", "heavy", etc., but that's not 100% reliable.

And so would I, but in the realm of scholarly publishing where we spend
huge amounts of money (10 billion dollars) the fonts are of appalling
quality. "AdvOTce3d9a73" is actually a bold font, with a symbol (not
Unicode encoding). I have had to find this out empirically. The only
practical answer seems to be crowdsourcing or to read the glyphs and find
out what is going on. Which is why it is useful to know where the
fontWeight is applied.



Peter Murray-Rust
Reader in Molecular Informatics
Unilever Centre, Dep. Of Chemistry
University of Cambridge

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message