comp.lang.ada
 help / color / mirror / Atom feed
* Pango in GtkAda Gtk version 3
@ 2014-01-31  9:27 ldries46
  2014-01-31 10:24 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2014-01-31  9:27 UTC (permalink / raw)


Is their an equivalent of the "Hello World" program for using 'Pango' within 
a drawing area.
If so where can I find it?
I need it to learn using Pango within a program

L. Dries 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pango in GtkAda Gtk version 3
  2014-01-31  9:27 Pango in GtkAda Gtk version 3 ldries46
@ 2014-01-31 10:24 ` Dmitry A. Kazakov
  2014-01-31 14:09   ` ldries46
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2014-01-31 10:24 UTC (permalink / raw)


On Fri, 31 Jan 2014 10:27:19 +0100, ldries46 wrote:

> Is their an equivalent of the "Hello World" program for using 'Pango' within 
> a drawing area.
> If so where can I find it?

Nowhere. GTK+ 3.x does not have drawing area anymore.

> I need it to learn using Pango within a program

To use a Pango font with Cairo, you should:

1. create a Pango_Layout on the given context (Create_Layout);
2. set Pango font there (Set_Font_Description);
3. set text to render into the layout (Set_Text);
4. draw the layout (Show_Layout_Line).

For further information see:

https://developer.gnome.org/pango/unstable/pango-Cairo-Rendering.html

Examples of use with GtkAda are here (require some adjustments for GTK
3.x).

http://www.dmitry-kazakov.de/ada/aicwl.htm

Since Pango fonts and Toy fonts are considerably different in their use,
the library has an abstraction layer in order to be able to use both.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pango in GtkAda Gtk version 3
  2014-01-31 10:24 ` Dmitry A. Kazakov
@ 2014-01-31 14:09   ` ldries46
  2014-01-31 18:40     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2014-01-31 14:09 UTC (permalink / raw)


After a while searching I could not find the procedure or function
Create_Layout. Finally I just found Show_Layout which shows a Layout in a 
CR.

procedure Show_Layout (Cr : Cairo_Context; Layout : Pango_Layout);

>To use a Pango font with Cairo, you should:

>1. create a Pango_Layout on the given context (Create_Layout);
>2. set Pango font there (Set_Font_Description);
>3. set text to render into the layout (Set_Text);
>4. draw the layout (Show_Layout_Line).

>Nowhere. GTK+ 3.x does not have drawing area anymore.

May be not but why is it then possible in Glade 3.14.2 to create one and you 
can write lines in it.

L. Dries 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pango in GtkAda Gtk version 3
  2014-01-31 14:09   ` ldries46
@ 2014-01-31 18:40     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2014-01-31 18:40 UTC (permalink / raw)


On Fri, 31 Jan 2014 15:09:25 +0100, ldries46 wrote:

> After a while searching I could not find the procedure or function
> Create_Layout.

I guess it is missing in GtkAda 3.4. Use this until AdaCore fixes that:

function Create_Layout (Context : Cairo_Context)
   return Pango_Layout is
   function Internal (Context : Cairo_Context) return Address;
   pragma Import (C, Internal, "pango_cairo_create_layout");
   Stub : Pango_Layout_Record;
begin
  return Pango_Layout (Get_User_Data (Internal (Context), Stub));
end Create_Layout;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-31 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-31  9:27 Pango in GtkAda Gtk version 3 ldries46
2014-01-31 10:24 ` Dmitry A. Kazakov
2014-01-31 14:09   ` ldries46
2014-01-31 18:40     ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox