Pango manual rendering

2014-08-01 Thread Edu García
Hi,

I want to use Pango for layout, but not for rendering. I have a proof of
concept that works, but I think it's not the right way of doing things :)

I create a PangoLayout with my text, then get a PangoLayoutIter, then I
start calling next_line() on it until it returns FALSE. On every iteration,
I get a run (that returns a PangoGlyphItem) and iterate over the contained
PangoGlyphString.

This works but, as I said, I think it's the wrong thing to do, I'm not sure
if depending on "next_line()" is a good idea, I'm not sure if there is a
correlation between that call and the call to "get_run()".

The second problem is that for every glyph, I get the PangoGlyphGeometry,
but the X and Y offsets are always 0. This might be just because the font's
I've tried work like that, but I just want to make sure.

Another unrelated question is, how can I disable ligatures using Pango?

Sorry if this is a bit confusing, but there is little to no information
about what I'm trying to do.

Thank you in advance!
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: Pango manual rendering

2014-08-01 Thread Behdad Esfahbod
On 14-08-01 11:04 AM, Edu García wrote:
> Hi,
> 
> I want to use Pango for layout, but not for rendering. I have a proof of
> concept that works, but I think it's not the right way of doing things :)
> 
> I create a PangoLayout with my text, then get a PangoLayoutIter, then I start
> calling next_line() on it until it returns FALSE. On every iteration, I get a
> run (that returns a PangoGlyphItem) and iterate over the contained
> PangoGlyphString.
> 
> This works but, as I said, I think it's the wrong thing to do, I'm not sure if
> depending on "next_line()" is a good idea, I'm not sure if there is a
> correlation between that call and the call to "get_run()".

I think that's how you are supposed to call it.


> The second problem is that for every glyph, I get the PangoGlyphGeometry, but
> the X and Y offsets are always 0. This might be just because the font's I've
> tried work like that, but I just want to make sure.

Keep accumulating the advance.  Just add X / Y offsets to the sum of advances
of previous glyphs on the line, to get the position of current glyph.


> Another unrelated question is, how can I disable ligatures using Pango?

Currently you can't.


> Sorry if this is a bit confusing, but there is little to no information about
> what I'm trying to do.


-- 
behdad
http://behdad.org/
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list


Re: Pango manual rendering

2014-08-01 Thread Edu García
Thank you for your response.

That's how I'm using the geometry right now, but I don't seem to get things
like alignment work. Even after setting a width on my layout, with right
alignment I get the exact same result as with left alignment (I assumed the
first glyph will get a very big X offset, to set the line start position,
but it's not happening)

As for ligatures, is there any way of getting the underlying Harfbuzz
handle and do it there, even with some sort of hack?

Again, thank you for your responses!
On Aug 2, 2014 6:51 AM, "Behdad Esfahbod"  wrote:

> On 14-08-01 11:04 AM, Edu García wrote:
> > Hi,
> >
> > I want to use Pango for layout, but not for rendering. I have a proof of
> > concept that works, but I think it's not the right way of doing things :)
> >
> > I create a PangoLayout with my text, then get a PangoLayoutIter, then I
> start
> > calling next_line() on it until it returns FALSE. On every iteration, I
> get a
> > run (that returns a PangoGlyphItem) and iterate over the contained
> > PangoGlyphString.
> >
> > This works but, as I said, I think it's the wrong thing to do, I'm not
> sure if
> > depending on "next_line()" is a good idea, I'm not sure if there is a
> > correlation between that call and the call to "get_run()".
>
> I think that's how you are supposed to call it.
>
>
> > The second problem is that for every glyph, I get the
> PangoGlyphGeometry, but
> > the X and Y offsets are always 0. This might be just because the font's
> I've
> > tried work like that, but I just want to make sure.
>
> Keep accumulating the advance.  Just add X / Y offsets to the sum of
> advances
> of previous glyphs on the line, to get the position of current glyph.
>
>
> > Another unrelated question is, how can I disable ligatures using Pango?
>
> Currently you can't.
>
>
> > Sorry if this is a bit confusing, but there is little to no information
> about
> > what I'm trying to do.
>
>
> --
> behdad
> http://behdad.org/
>
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list