
Hello Haskellers, I'm pleased to announce two new packages, whom work hand in hand: FontyFruity, a truetype file parser, and Rasterific a vector drawing engine. This two libraries enable us to generate pictures without the need of an external C library, and saving them to a file or directly send them over the network. FontyFruity: * hackage : http://hackage.haskell.org/package/FontyFruity * Github : https://github.com/Twinside/FontyFruity Rasterific: * hackage : http://hackage.haskell.org/package/Rasterific * Github : https://github.com/Twinside/Rasterific Regards Vincent

Awesome! Would it be possible to use FontyFruity to remove the limitations of Text in Diagrams (see below)? Is there something missing in Rasterific to render SVG?
From http://projects.haskell.org/diagrams/doc/manual.html#text
Text objects take up no space!
The main reason for this is that computing the size of some text in a given font is rather complicated, and diagrams cannot (yet) do it natively. The cairo backend can do it (see below) but we don't want to tie diagrams to a particular backend. The second reason is that font size is handled similarly to line width, so the size of a text object cannot be known at the time of its creation anyway! (Future versions of ``diagrams`` may include some sort of constraint-solving engine to be able to handle this sort of situation, but don't hold your breath.) Font size is treated similarly to line width for a similar reason: we often want disparate text elements to be the same size, but those text elements may be part of subdiagrams that have been transformed in various ways. Note: I wish this were true, but currently it isn't. At some future date when we do an overhaul of this stuff and introduce units, perhaps users can choose which behavior they want. -- byorgey 20 Nov 2013
Note, however, that the cairo backend includes a module Diagrams.Backend.Cairo.Text with functions for querying font and text extents, and creating text diagrams that take up an appropriate amount of space. So it is possible to have automatically-sized text objects, at the cost of being tied to the cairo backend and bringing IO into the picture (or being at peace with some probably-justified uses of unsafePerformIO).
Cheers
Sylvain
2014-02-28 9:13 GMT+01:00 Vincent Berthoux
Hello Haskellers,
I'm pleased to announce two new packages, whom work hand in hand: FontyFruity, a truetype file parser, and Rasterific a vector drawing engine. This two libraries enable us to generate pictures without the need of an external C library, and saving them to a file or directly send them over the network.
FontyFruity: * hackage : http://hackage.haskell.org/package/FontyFruity * Github : https://github.com/Twinside/FontyFruity
Rasterific: * hackage : http://hackage.haskell.org/package/Rasterific * Github : https://github.com/Twinside/Rasterific
Regards
Vincent
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi Sylvain,
It should be possible, but in order to get the extent of a text element,
you need the point size and the DPI of your output medium. Please, don't
hesitate to fill a ticket on the github page.
Regards
Vincent
2014-02-28 9:49 GMT+01:00 Sylvain Henry
Awesome! Would it be possible to use FontyFruity to remove the limitations of Text in Diagrams (see below)? Is there something missing in Rasterific to render SVG?
From http://projects.haskell.org/diagrams/doc/manual.html#text
Text objects take up no space!
The main reason for this is that computing the size of some text in a given font is rather complicated, and diagrams cannot (yet) do it natively. The cairo backend can do it (see below) but we don't want to tie diagrams to a particular backend. The second reason is that font size is handled similarly to line width, so the size of a text object cannot be known at the time of its creation anyway! (Future versions of ``diagrams`` may include some sort of constraint-solving engine to be able to handle this sort of situation, but don't hold your breath.) Font size is treated similarly to line width for a similar reason: we often want disparate text elements to be the same size, but those text elements may be part of subdiagrams that have been transformed in various ways. Note: I wish this were true, but currently it isn't. At some future date when we do an overhaul of this stuff and introduce units, perhaps users can choose which behavior they want. -- byorgey 20 Nov 2013
Note, however, that the cairo backend includes a module Diagrams.Backend.Cairo.Text with functions for querying font and text extents, and creating text diagrams that take up an appropriate amount of space. So it is possible to have automatically-sized text objects, at the cost of being tied to the cairo backend and bringing IO into the picture (or being at peace with some probably-justified uses of unsafePerformIO).
Cheers Sylvain
2014-02-28 9:13 GMT+01:00 Vincent Berthoux
: Hello Haskellers,
I'm pleased to announce two new packages, whom work hand in hand: FontyFruity, a truetype file parser, and Rasterific a vector drawing engine. This two libraries enable us to generate pictures without the need of an external C library, and saving them to a file or directly send them over the network.
FontyFruity: * hackage : http://hackage.haskell.org/package/FontyFruity * Github : https://github.com/Twinside/FontyFruity
Rasterific: * hackage : http://hackage.haskell.org/package/Rasterific * Github : https://github.com/Twinside/Rasterific
Regards
Vincent
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Sylvain Henry
-
Vincent Berthoux