Hi,
First of all Sorry for the inconvenience, thanks again.
> first of, please don't cross-post on multiple mailing-list. It is
> almost impossible for anyone to respond to your questions since that
> would require to be subscribed to all these lists. Cross-posting is a
> clear violation of the netiquette. You aren't doing yourself a favor
> by doing that.
>
> > i want to know, how a UTF-8 string is getting mapped onto a proper
> > .ttf font file, as i am not explisitely mentioning any font related
> > details or library.
>
> Pango and fontconfig do this for you in a non-trivial fashion. What
> exactly do you want to know?
>
Here in my code, i just mention 3 different UTF-8 strings as labels on 3
diffrerent buttons, and i am not mentioning any font related info here.
But still the pango is able to render proper language fonts. I went in
fonts-cache-1 file & tried to swapp the font files in terms of their order.
But still it's abl;e to render exact language fonts, so i want know how
exactly ht epango is able to map excat .ttf files for a given UTF-8 string.
Using this in my application i want take control of font changing & style &
size changes across multiple ttf files.
> > However if i use pango_layout_set_text(), and gtk_draw_layout() ,
> > nothing is getting displayed.
>
> You are doing something wrong then. Please show us some example code.
>
Here i have attached 2 simple code examples for ur reference.
PLs guide me for further. I donno if at all i can send attachments in mail
lists, or do i have to paste in the mail body itself? Pardon me if i have
done the wrong thing..
regards,
Bheemesh
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
gchar first_button[] = {0xe0,0xb2,0xaa,0xe0,0xb3,0x8d,0xe0,0xb2,0xb0,0xe0,0xb2,
0xa5,0xe0,0xb2,0xae,0x0a, 0};
void my_code()
{
GtkWidget *win;
GtkWidget *gl;
GtkWidget *button;
PangoFontDescription *fd;
fd = pango_font_description_from_string("Sampige 20");
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request(win, 400, 400);
gl = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(win), gl);
button = gtk_button_new();
gtk_fixed_put(GTK_FIXED(gl), button, 24, 70);
gtk_widget_set_size_request(button, 344, 62);
gtk_widget_create_pango_layout(button, first_button);
gtk_widget_modify_font(button, fd);
gtk_widget_show_all(win);
}
int main(int argc, char **argv)
{
gtk_init (&argc, &argv);
my_code();
gtk_main();
return 0;
}
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
gchar first_button[] = {0xe0,0xb2,0xaa,0xe0,0xb3,0x8d,0xe0,0xb2,0xb0,0xe0,0xb2,
0xa5,0xe0,0xb2,0xae,0x0a, 0};
void my_code()
{
GtkWidget *win;
GtkStyle *style;
GtkWidget *gl;
GtkWidget *label;
GdkRectangle gr = { 10, 10, 100, 100 };
PangoContext *pc;
PangoLayout *pl;
PangoFontDescription *font_desc;
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request(win, 400, 400);
gl = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(win), gl);
pc = pango_context_new();
pl = pango_layout_new(pc);
pango_layout_set_text(pl, first_button, strlen(first_button));
font_desc = pango_font_description_from_string("Sampige 20");
pango_layout_set_font_description(pl, font_desc);
style = gtk_style_new();
style->font_desc = font_desc;
label = gtk_label_new(first_button);
gtk_container_add(GTK_CONTAINER(gl), label);
#if 0
gtk_paint_layout(style, label->window, GTK_STATE_NORMAL, TRUE, &gr, label,
"", 11, 11, pl);
#else
gtk_draw_layout(style, label->window, GTK_STATE_NORMAL, TRUE, 10, 10, pl);
#endif
gtk_widget_show_all(win);
}
int main(int argc, char **argv)
{
gtk_init (&argc, &argv);
my_code();
gtk_main();
return 0;
}