Re: regarding all the possible functions that can be assigned to PangoCairoShapeRendererFunc func




On Sep 8, 2012, at 7:21 AM, Parth Kanungo <kanungoparth gmail com> wrote:

Thanks John.

The ShapeRenderer function draws whatever you like on the supplied cairo context. See pango_attr_shape_new() [1].
 
I don't think that it makes sense to implement it anywhere except PangoCairo: That's the *destination*; the others (including ft2) are font sources, meaning that they provide the glyph metrics that Pango uses to layout lines of text and to render them onto a cairo surface for display. Is that what you mean by "elaborate on the bigger picture"?
 
Yes, that is exactly what I meant by "the bigger picture". So, now, we agree that the ShapeRenderer function displays the attributes supplied in the cairo context.
 
Now, I need a similar ShapeRenderer function that displays the attributes supplied while using pangoft2.

To further clarify my problem-statement, let me add the following:
When we compare the pangoft2-render.c's and pangocairo-render.c's renderer_class_init functions, we observer that pangoft2-render.c initializes only 2 functions whereas pangocairo-render.c initializes 6 functions ( including renderer_class->draw_shape = pango_cairo_renderer_draw_shape )
 
Now, here's my assertion. (correct me, if I am wrong)
I think that it is the presence of these initialized functions that enables pangocairo to render different styles(italic/oblique), variants, weights(thin, normal, ultraheavy), stretch etc. and other attributes, which are impossible to render in pangoft2.

If I am correct, then you can understand why I want to implement the ShapeRenderer function.

If I am wrong, then lets forget this whole discussion, and let me put up a simple question:
How can I render different styles(italic/oblique), variants, weights(thin, normal, ultraheavy), stretch etc. and other attributes while using pangoft2 ?

I hope that I was able to explain my question in a better manner this time. Thanks again. :)
 

I'll cut right to the chase: No, you're wrong on two counts. First and most important, you can't compare FT2 and Cairo. FT2 is a font-metrics provider, like CoreText, Xft, and Win32. Cairo is the drawing engine that sits between Pango and the OS's Windowing system (X, Quartz, Win32, HTML5, etc.). Pango gets the codepoints and font designation and attributes from the client program, then retrieves the font metrics from the (eg) FT2 backend for the glyphs that it needs to render, and then uses Cairo Rendering to draw them on a Cairo Surface for display.

You second error is believing that ShapeRenderer draws modified faces. It doesn't. It can't, because it doesn't take font metrics as an input. Read the Text Attributes section [1] and note PANGO_ATTR_STYLE, PANGO_ATTR_WEIGHT, and PANGO_ATTR_VARIANT.

So, to answer your "simple question", apply the appropriate attributes to your text. The easy way is to use the provided markup language [2].

Regards,
John Ralls




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]