List Info

Thread: Problem Using Persian Fonts




Problem Using Persian Fonts
user name
2006-05-08 10:08:40
Hi Behdad
By the way,I had included the test program, (I had pasted it.)

Regards
Ali

On 5/8/06, Ali Majdzadeh <gmail.com">ali.majdzadehgmail.com> wrote:
Hi Behdad
Thanks for your response.
You are right. But I am new to Pango and Gtk+ and I could not find any tutorial explaining a sample test program that utilizes Pango's font-related APIs.
Can you explain the procedure (specifically for Persian)?
I have installed a series of standard Persian fonts which I think Mr.Pournader have
published. Other programs like OpenOffice work well.

Regards
Ali


On 5/8/06, Behdad Esfahbod <cs.toronto.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> behdadcs.toronto.edu> wrote:

Didn't you send this already?&nbsp; I think anyone would have replied
the first time if they had something to add.  With the
information you give in your problem report (or lack thereof), I
don't think anybody can help you.  You have not even attached
your complete test program with the Persian text.

behdad

On Mon, 8 May 2006, Ali Majdzadeh wrote:

&gt; Hi Everybody
> I tried to compile and run an example which I found from the list.
> I installed Persian fonts and changed the source in order to show
> some Farsi texts, the program compiles and runs without any errors, but
> it can not load the font which I specify.
&gt; Other applications like OpenOffice and KOffice recognize my fonts.
>; Any ideas?
&gt;
> Regards
&gt; Ali
>
&gt; Code:
>
> #include <gtk/gtk.h>
>; int size=15;
&gt; void g_exit_callback(GtkWidget *w) &nbsp;{ gtk_main_quit(); }
>
>;
> gboolean play_font(gpointer data)
>; {
> GdkRectangle updateRect;
> updateRect.x=0; updateRect.y=0;
> updateRect.width=240; updateRect.height=320;
> gtk_widget_draw(GTK_WIDGET(data),&updateRect);
>; }
>
>;
> void drawing_callback(GtkWidget *lWidget)
> {
> printf(&quot;drawing_callback\n&quot;);
>; PangoContext &nbsp; &nbsp; &nbsp;   ; &nbsp; *context=NULL;
> PangoLayout &nbsp; &nbsp; &nbsp; &nbsp;   ;  *layout=NULL;
> PangoFontDescription&nbsp;   ;*fontdesc=NULL;
>
>
> context = gtk_widget_get_pango_context(lWidget);
> layout = pango_layout_new(context);
> fontdesc = &nbsp;pango_font_description_new();
>
>
&gt; // function that i suspect of leaks -
> one
> pango_font_description_set_family(fontdesc,"Terafik");
> // function that i suspect of leaks - two
> pango_font_description_set_size(fontdesc,size*PANGO_SCALE);
>
>
> pango_layout_set_font_description (layout, fontdesc);
> pango_layout_set_text(layout, "Farsi Text Here", 6); &nbsp;  //I could not paste
> Farsi!
>; pango_layout_set_font_description (layout, fontdesc);
> pango_layout_set_text(layout, "Farsi Text Here", 6); //I could not paste
> Farsi!
>;
>
> gdk_draw_layout(lWidget->window, lWidget-&gt;style->;fg_gc[GTK_STATE_NORMAL] , 5
> , 10 , layout);
>
>
&gt; pango_font_description_free (fontdesc);
> g_object_unref (layout);
> size++;
&gt; }
>
>;
>
>
> int main(int argc, char **argv)
&gt; {
> gtk_init(NULL,NULL);
>
>
> GtkWidget *pwWindow;
> GtkWidget *pWidget;
>
>
&gt; pwWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> gtk_window_set_title (GTK_WINDOW (pwWindow), "TEST Widget&quot;);
> gtk_window_set_position (GTK_WINDOW (pwWindow), GTK_WIN_POS_CENTER_ALWAYS);
> g_signal_connect (G_OBJECT (pwWindow), "destroy",G_CALLBACK
&gt; (g_exit_callback), NULL);
>;
>
> pWidget = gtk_drawing_area_new();
> gtk_container_add(GTK_CONTAINER(pwWindow), pWidget);
> g_signal_connect (G_OBJECT (pWidget),"expose_event&quot;, G_CALLBACK
> (drawing_callback), NULL);
>; g_timeout_add(100,(GSourceFunc)play_font,pWidget);
&gt;
>
>; gtk_widget_show (pWidget);
> gtk_widget_show (pwWindow);
> gtk_main ();
> return 0;
> }
>

--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill";
 &nbsp; &nbsp; &nbsp;  -- Dan Bern, "New American Language&quot;


Problem Using Persian Fonts
user name
2006-05-08 13:06:53
Hi Behdad
I think I solved the problem, my test program ran correctly and I was able to change fonts. I think the problem was about the configuration of installed fonts.
Thanks a lot anyway

Regards
Ali

On 5/8/06, Ali Majdzadeh <gmail.com">ali.majdzadehgmail.com> wrote:
Hi Behdad
By the way,I had included the test program, (I had pasted it.)

Regards
Ali


On 5/8/06, Ali Majdzadeh <gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> ali.majdzadehgmail.com> wrote:
Hi Behdad
Thanks for your response.
You are right. But I am new to Pango and Gtk+ and I could not find any tutorial explaining a sample test program that utilizes Pango's font-related APIs.
Can you explain the procedure (specifically for Persian)?
I have installed a series of standard Persian fonts which I think Mr.Pournader have
published. Other programs like OpenOffice work well.

Regards
Ali


On 5/8/06, Behdad Esfahbod <cs.toronto.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> behdadcs.toronto.edu> wrote:

Didn't you send this already?&nbsp; I think anyone would have replied
the first time if they had something to add.  With the
information you give in your problem report (or lack thereof), I
don't think anybody can help you.  You have not even attached
your complete test program with the Persian text.

behdad

On Mon, 8 May 2006, Ali Majdzadeh wrote:

&gt; Hi Everybody
> I tried to compile and run an example which I found from the list.
> I installed Persian fonts and changed the source in order to show
> some Farsi texts, the program compiles and runs without any errors, but
> it can not load the font which I specify.
&gt; Other applications like OpenOffice and KOffice recognize my fonts.
>; Any ideas?
&gt;
> Regards
&gt; Ali
>
&gt; Code:
>
> #include <gtk/gtk.h>
>; int size=15;
&gt; void g_exit_callback(GtkWidget *w) &nbsp;{ gtk_main_quit(); }
>
>;
> gboolean play_font(gpointer data)
>; {
> GdkRectangle updateRect;
> updateRect.x=0; updateRect.y=0;
> updateRect.width=240; updateRect.height=320;
> gtk_widget_draw(GTK_WIDGET(data),&updateRect);
>; }
>
>;
> void drawing_callback(GtkWidget *lWidget)
> {
> printf(&quot;drawing_callback\n&quot;);
>; PangoContext &nbsp; &nbsp; &nbsp;   ; &nbsp; *context=NULL;
> PangoLayout &nbsp; &nbsp; &nbsp; &nbsp;   ;  *layout=NULL;
> PangoFontDescription&nbsp;   ;*fontdesc=NULL;
>
>
> context = gtk_widget_get_pango_context(lWidget);
> layout = pango_layout_new(context);
> fontdesc = &nbsp;pango_font_description_new();
>
>
&gt; // function that i suspect of leaks -
> one
> pango_font_description_set_family(fontdesc,"Terafik");
> // function that i suspect of leaks - two
> pango_font_description_set_size(fontdesc,size*PANGO_SCALE);
>
>
>; pango_layout_set_font_description (layout, fontdesc);
> pango_layout_set_text(layout, "Farsi Text Here", 6); &nbsp;  //I could not paste
> Farsi!
>; pango_layout_set_font_description (layout, fontdesc);
> pango_layout_set_text(layout, "Farsi Text Here", 6); //I could not paste
> Farsi!
>;
>
> gdk_draw_layout(lWidget->window, lWidget-&gt;style->;fg_gc[GTK_STATE_NORMAL] , 5
> , 10 , layout);
>
>
&gt; pango_font_description_free (fontdesc);
> g_object_unref (layout);
> size++;
&gt; }
>
>;
>
>
> int main(int argc, char **argv)
&gt; {
> gtk_init(NULL,NULL);
>
>
> GtkWidget *pwWindow;
> GtkWidget *pWidget;
>
>
&gt; pwWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> gtk_window_set_title (GTK_WINDOW (pwWindow), "TEST Widget&quot;);
> gtk_window_set_position (GTK_WINDOW (pwWindow), GTK_WIN_POS_CENTER_ALWAYS);
> g_signal_connect (G_OBJECT (pwWindow), "destroy",G_CALLBACK
&gt; (g_exit_callback), NULL);
>;
>
> pWidget = gtk_drawing_area_new();
> gtk_container_add(GTK_CONTAINER(pwWindow), pWidget);
> g_signal_connect (G_OBJECT (pWidget),"expose_event&quot;, G_CALLBACK
> (drawing_callback), NULL);
>; g_timeout_add(100,(GSourceFunc)play_font,pWidget);
&gt;
>
>; gtk_widget_show (pWidget);
> gtk_widget_show (pwWindow);
> gtk_main ();
> return 0;
> }
>

--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill";
 &nbsp; &nbsp; &nbsp;  -- Dan Bern, "New American Language&quot;




[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )