Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

font rendering is dependent on resolution (PNG output via Cairo) #18

Open
fryguybob opened this issue Aug 4, 2012 · 0 comments
Open

Comments

@fryguybob
Copy link
Member

(Imported from http://code.google.com/p/diagrams/issues/detail?id=67. Original issue from andras.g...@gmail.com on February 20, 2012, 03:18:29 PM UTC)

The following two commands give slightly different output:

  1. withArgs [ "-o", "test.png", "-w", "800", "-h", "800" ] $ defaultMain $ ((text "ABCDEFGHabcdefgh" # fontSize 2 # translate (8,0) <> rect 10 1 # lw 0.1) # translate (-5,0)) <> rect 12 12 # lw 0.2
  2. withArgs [ "-o", "test.png", "-w", "400", "-h", "400" ] $ defaultMain $ ((text "ABCDEFGHabcdefgh" # fontSize 2 # translate (8,0) <> rect 10 1 # lw 0.1) # translate (-5,0)) <> rect 12 12 # lw 0.2

The only difference in the commands being the resolution of the final
PNG image, this shouldn't be so. The most noticable difference is the
blank triangle enclosed by the 'A' and the rectangle lines.

I'm using Diagrams 0.4 via cabal on Debian "testing".

A thought after the discussion on #diagrams:

Maybe we need a way of specifying final size explicitly? In TeX,
there's a way of rendering a font at a given resolution and then scale
it: I can either use "cmr12" or "cmr10 at 12pt", which both give fonts
of the same height, but slightly different characters.

Given that TeX knows the size on paper (and Diagrams doesn't), that
might be what we need. How about a way of specifying either
resolution (as in pixels per inch) or the printed size of the final
output? The latter would allow my two examples to look exactly the
same since the printed size is the same, only the number of pixels
changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant