[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: [Haskell-cafe] [ANN] Rasterific & FontyFruity
From: Vincent Berthoux <vincent.berthoux () gmail ! com>
Date: 2014-02-28 9:07:03
Message-ID: CALCmskWzDE+1Qc-mrzz239QFxvzt+-SpA0xc2m1eZmR=akaorw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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 <hsyl20@gmail.com>:
> 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 <vincent.berthoux@gmail.com>:
>
>> 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
>>
>>
>
[Attachment #5 (text/html)]
<div dir="ltr"><div><div><div>Hi Sylvain,<br><br></div> 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.<br> <br></div> Regards<br><br></div> Vincent<br></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">2014-02-28 9:49 GMT+01:00 \
Sylvain Henry <span dir="ltr"><<a href="mailto:hsyl20@gmail.com" \
target="_blank">hsyl20@gmail.com</a>></span>:<br> <blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
dir="ltr">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?<br> <br>From <a href="http://projects.haskell.org/diagrams/doc/manual.html#text" \
target="_blank">http://projects.haskell.org/diagrams/doc/manual.html#text</a><br> \
<br>> Text objects take up no space!<br><br>> 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.<br>
> 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<br>
<br>> 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).<br>
<br>Cheers<br>Sylvain<br></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">2014-02-28 9:13 GMT+01:00 Vincent Berthoux <span dir="ltr"><<a \
href="mailto:vincent.berthoux@gmail.com" \
target="_blank">vincent.berthoux@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div><div class="h5"><div \
dir="ltr"><div><div><div><div><div><div><div><div>Hello Haskellers,<br><br></div> \
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.<br>
<br>FontyFruity:<br></div> * hackage : <a \
href="http://hackage.haskell.org/package/FontyFruity" \
target="_blank">http://hackage.haskell.org/package/FontyFruity</a><br></div> * \
Github : <a href="https://github.com/Twinside/FontyFruity" \
target="_blank">https://github.com/Twinside/FontyFruity</a><br>
<br></div>Rasterific:<br></div> * hackage : <a \
href="http://hackage.haskell.org/package/Rasterific" \
target="_blank">http://hackage.haskell.org/package/Rasterific</a><br></div> * Github \
: <a href="https://github.com/Twinside/Rasterific" \
target="_blank">https://github.com/Twinside/Rasterific</a><br>
<br></div> Regards<span><font \
color="#888888"><br><br></font></span></div><span><font color="#888888"> \
Vincent<br></font></span></div> \
<br></div></div>_______________________________________________<br> Haskell-Cafe \
mailing list<br> <a href="mailto:Haskell-Cafe@haskell.org" \
target="_blank">Haskell-Cafe@haskell.org</a><br> <a \
href="http://www.haskell.org/mailman/listinfo/haskell-cafe" \
target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br> \
<br></blockquote></div><br></div> </blockquote></div><br></div>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic