Erikhht / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

No support for skewing and stretching text to mimic italics and bold for fonts that do not have bold, italic and oblique font files #134

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
iText has support for mimicking bold and italics (and both) for text using 
fonts that do not have font files for bold, italic and oblique. The do this by 
allowing you to skew and stretch the rendering of text. Flying Saucer does not 
appear to have such support for this functionality.

This is a critical feature as most fonts do not have these additional font 
files and leave it up the the renderer to mimic bolding and italics. This is 
crucial functionality for a user if they want to use fonts other than the given 
Helvetica, Times, and Courier fonts.

Original issue reported on code.google.com by loe...@gmail.com on 23 Mar 2011 at 3:41

GoogleCodeExporter commented 9 years ago
If we can borrow the techniques used by iText itself, this should be relatively 
straightforward to implement.  It would affect font resolution, the font 
wrapper object itself, font metric calculation (and indirectly layout, but we'd 
get this for free), and rendering.

(That said, isn't it typical that a font family will include various weights 
and styles?  This is the first time a request for something like this has come 
up.)

Original comment by Peter.Br...@gmail.com on 24 Mar 2011 at 12:59

GoogleCodeExporter commented 9 years ago
It is common, but not all fonts come with them. A good example is Arial Unicode 
MS. This is an Arial font, but has no bold, italic or oblique font file. 
Despite this, most word processors and other software (e.g. web browsers) can 
still change the weight and style of these fonts. There is a short blurb in the 
iText in Action book about this.

"If you have to use a font for which you can’t find the corresponding font 
with italic or oblique style, you can use setSkew(0,25) to simulate italics ... 
snip ... If you have to use a font for which you can’t find the corresponding 
font with bold style, you could use setTextRenderMode(PdfContentByte .TEXT_ 
RENDER_MODE_FILL_STROKE, 0.5f, null) to simulate bold" ~ Chapter 3, iText in 
Action

Of course though, they are using their own markup framework objects to do this 
(e.g. Chunks and Phrases). I'm not sure how this translates when using a 
PdfContentByte.

Original comment by loe...@gmail.com on 24 Mar 2011 at 9:31

GoogleCodeExporter commented 9 years ago
Does anyone know if this has been done yet?  I'm having the same issue with 
Tahoma and have just spent a couple of days getting a document to exact specs 
and now can't seem to get the italic text italic.

Original comment by aplossystems@gmail.com on 7 Sep 2013 at 2:59

GoogleCodeExporter commented 9 years ago
This commit: 
https://github.com/flyingsaucerproject/flyingsaucer/commit/c658cfc956e66df2b1803
a64d5a793a2ab411ce5#L5R485 seems to have implemented this, but emulating bold 
gives unexpected result with colored text. The stroke color is always black no 
matter what the font color is set to and the result is outlined text with black 
borders.

Original comment by mati.us...@gmail.com on 20 Sep 2013 at 11:59

GoogleCodeExporter commented 9 years ago
I've installed it and it's doing what I'm after, thanks for heads up :)

Original comment by aplossystems@gmail.com on 21 Sep 2013 at 12:34