[cairo] Want to stretch my fonts

Kayven Riese kayvey at gmail.com
Wed Jul 28 00:14:02 PDT 2010


On Tue, Jul 27, 2010 at 11:58 PM, Behdad Esfahbod <behdad at behdad.org> wrote:

> On 07/28/10 02:56, Kayven Riese wrote:
> > but that takes only cr as an argument.. so it is going to scale my
> > entire canvas right?  I need to learn to make my letters on a different
> > canvas and combine the two canvases or something, don't I?
>
> Check out cairo_set_font_matrix().
>

 http://cairographics.org/manual/cairo-text.html#cairo-set-font-matrix

OK.. umm.. so I use what Andrea said to change this matrix? umm.. I suspect
I need to use a function that is going to create a font matrix that is to my
liking.. umm.. I probably need to get the existing font matrix some how..
first I use the function right below to get the matrix.. so

 I already created my personal variable "fatrix"

 18         cairo_matrix_t * fatrix;

That's in the file I originally attached.. so now I am going to use the get
and set functions.. but in between, don't I have to rescale my matrix some
how?

so This function

http://cairographics.org/manual/cairo-matrix.html#cairo-matrix-t

cairo_matrix_init_scale ()

void                cairo_matrix_init_scale
(cairo_matrix_t
<http://cairographics.org/manual/cairo-matrix.html#cairo-matrix-t>
*matrix,
                                                         double sx,
                                                         double sy);

 Initializes *matrix* to a transformation that scales by *sx* and *sy* in
the X and Y dimensions, respectively.

   *matrix* :
 a cairo_matrix_t<http://cairographics.org/manual/cairo-matrix.html#cairo-matrix-t>

*sx* :
 scale factor in the X direction

*sy* :
 scale factor in the Y direction


in betweem get and set?



> behdad
>
>
> > On Tue, Jul 27, 2010 at 11:50 PM, Kayven Riese <kayvey at gmail.com
> > <mailto:kayvey at gmail.com>> wrote:
> >
> >     but that takes only cr as an argument.. so it is going to scale my
> >     entire canvas right?  I need to learn to make my letters on a
> >     different canvas and combine the two canvases or something, don't I?
> >
> >
> >     On Tue, Jul 27, 2010 at 11:42 PM, Andrea Canciani <ranma42 at gmail.com
> >     <mailto:ranma42 at gmail.com>> wrote:
> >
> >         On Wed, Jul 28, 2010 at 8:09 AM, Kayven Riese <kayvey at gmail.com
> >         <mailto:kayvey at gmail.com>> wrote:
> >         > Hi, I have attached four files (oops five--see below) so that
> >         if somebody
> >         > has a UNIX command line hopefully you just save them and do
> >         "make stub" and
> >         > you can run my code. For compatibility here is my CentOS uname:
> >         > [root at localhost ~]# uname -a
> >         > Linux localhost 2.6.18-194.8.1.el5 #1 SMP Thu Jul 1 19:04:48
> >         EDT 2010 x86_64
> >         > x86_64 x86_64 GNU/Linux
> >         > [root at localhost ~]#
> >         >
> >         > My goal is to create a "cellgam.png" but to have more control
> >         over the
> >         > font.  I want to stretch it vertically.  In the example, I
> >         think I ran the
> >         > program with the command
> >         >
> >         > ./stub 2 2 3 3
> >         >
> >         > which means that 20% of the proteins are nuclear.  I want the
> >         word "Nuclear"
> >         > to have an extent that represents 20% of the vertical height
> >         of the diagram,
> >         > but I want it to still be contained in my "cell" the rounded
> >         rectangle I
> >         > have drawn.  The rectangle is intended to have a vertical
> >         extent propotional
> >         > to the first three arguments.
> >         >
> >         > All that is a ball of wax I can handle.  The only thing I am
> >         asking is how
> >         > do I control what is happening to my text to transform it
> >         vertically within
> >         > a box that I chose.  I got the idea for what I am doing from
> >         the fifth file
> >         > I just attached, "bp_font.jpeg"  I want to be able to stretch
> >         the word
> >         > "Nuclear" so it is taller, but control the width to be
> >         narrower to still fit
> >         > inside my cell.
> >         You can't do that just by changing the font size. You should use
> >         cairo_scale with
> >         appropriate arguments (see
> >         http://cairographics.org/manual/cairo-transformations.html )
> >         Hope this helps
> >         Andrea
> >
> >
> >
> >
> >     --
> >
> >     *----------------------------------------------------------*
> >       Kayven Riese, BSCS,
> >                           MS  (Physiology and Biophysics)
> >       (415) 902 5513 cellular
> >       http://kayve.net
> >       Webmaster http://ChessYoga.org
> >     *----------------------------------------------------------*
> >
> >
> >
> >
> >
> >
> > --
> >
> > *----------------------------------------------------------*
> >   Kayven Riese, BSCS,
> >                       MS  (Physiology and Biophysics)
> >   (415) 902 5513 cellular
> >   http://kayve.net
> >   Webmaster http://ChessYoga.org
> > *----------------------------------------------------------*
> >
> >
> >
> >
> >
> > --
> > cairo mailing list
> > cairo at cairographics.org
> > http://lists.cairographics.org/mailman/listinfo/cairo
>



-- 

*----------------------------------------------------------*
  Kayven Riese, BSCS,
                      MS  (Physiology and Biophysics)
  (415) 902 5513 cellular
  http://kayve.net
  Webmaster http://ChessYoga.org
*----------------------------------------------------------*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100728/4af89df3/attachment.html>


More information about the cairo mailing list