[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paragui-cvs] CVS: paragui/plugins/pango pango.cpp,1.1.2.2,1.1.2.3
From: |
Teunis Peters <address@hidden> |
Subject: |
[paragui-cvs] CVS: paragui/plugins/pango pango.cpp,1.1.2.2,1.1.2.3 |
Date: |
Fri, 08 Nov 2002 16:08:42 -0500 |
Update of /cvsroot/paragui/paragui/plugins/pango
In directory subversions:/tmp/cvs-serv6377/plugins/pango
Modified Files:
Tag: devel-opengl
pango.cpp
Log Message:
working pango demo. more work to make it into a plugin still needed though :)
Index: pango.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/plugins/pango/Attic/pango.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** pango.cpp 8 Nov 2002 11:22:01 -0000 1.1.2.2
--- pango.cpp 8 Nov 2002 21:08:40 -0000 1.1.2.3
***************
*** 81,85 ****
/* Paragraph *para = g_new(Paragraph, 1); */
Paragraph *para = new Paragraph;
! para->length = (int)(p - last_para);
// fprintf(stderr, "%s:%i data [%i]=\'%s\'\n", __FUNCTION__,
__LINE__, para->length, last_para);
para->text = std::string(last_para, para->length);
--- 81,85 ----
/* Paragraph *para = g_new(Paragraph, 1); */
Paragraph *para = new Paragraph;
! para->length = (int)(p - last_para) + 1;
// fprintf(stderr, "%s:%i data [%i]=\'%s\'\n", __FUNCTION__,
__LINE__, para->length, last_para);
para->text = std::string(last_para, para->length);
***************
*** 262,271 ****
}
int main(int argc, char* argv[]) {
int dpi_x = 100, dpi_y = 100;
! string init_family = "sans";
! int init_scale = 14; /* 24; */
PangoDirection init_dir = PANGO_DIRECTION_LTR;
string text;
string lang;
--- 262,322 ----
}
+ /* from gtk+ fontsel */
+ #if 0
+ static int
+ compare_font_descriptions (const PangoFontDescription *a, const
PangoFontDescription *b)
+ {
+ int val = strcmp (pango_font_description_get_family (a),
pango_font_description_get_family (b));
+ if (val != 0)
+ return val;
+
+ if (pango_font_description_get_weight (a) !=
pango_font_description_get_weight (b))
+ return pango_font_description_get_weight (a) -
pango_font_description_get_weight (b);
+
+ if (pango_font_description_get_style (a) !=
pango_font_description_get_style (b))
+ return pango_font_description_get_style (a) -
pango_font_description_get_style (b);
+
+ if (pango_font_description_get_stretch (a) !=
pango_font_description_get_stretch (b))
+ return pango_font_description_get_stretch (a) -
pango_font_description_get_stretch (b);
+
+ if (pango_font_description_get_variant (a) !=
pango_font_description_get_variant (b))
+ return pango_font_description_get_variant (a) -
pango_font_description_get_variant (b);
+
+ return 0;
+ }
+
+ static int
+ faces_sort_func (const void *a, const void *b)
+ {
+ PangoFontDescription *desc_a = pango_font_face_describe (*(PangoFontFace
**)a);
+ PangoFontDescription *desc_b = pango_font_face_describe (*(PangoFontFace
**)b);
+
+ int ord = compare_font_descriptions (desc_a, desc_b);
+
+ pango_font_description_free (desc_a);
+ pango_font_description_free (desc_b);
+
+ return ord;
+ }
+
+ static int
+ cmp_families (const void *a, const void *b)
+ {
+ const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
+ const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
+
+ return g_utf8_collate (a_name, b_name);
+ }
+ #endif
+ /* end from gtk+ fontsel */
+
int main(int argc, char* argv[]) {
int dpi_x = 100, dpi_y = 100;
! string init_family = "FreeSans"; // "Courier New"; | "runic" (on my system)
! // serif | monospace | sans
! int init_scale = 12; /* 24; */
PangoDirection init_dir = PANGO_DIRECTION_LTR;
+ /* PANGO_DIRECTION_LTR | _RTL | TTB_LTR | TTB_RTL */
string text;
string lang;
***************
*** 280,288 ****
PG_VideoDriver* gldriver = NULL;
! text = std::string("Hello, World");
// Arabic
// text =
"�����������";
// Japanese
// text = "�����,
コï¾��¾��¾��¾� é¨��©�;
// Hebrew
// text = "����;
--- 331,344 ----
PG_VideoDriver* gldriver = NULL;
! text = std::string("Hello Îειά ÏÎ±Ï (æ¥æ¬èª) - Pango
Demonstration");
!
! // text = std::string("Hello, World");
! // Greek
! // text = std::string("\u03a0\u03b1\u03bd");
// Arabic
// text =
"�����������";
// Japanese
// text = "�����,
コï¾��¾��¾��¾� é¨��©�;
+ // text = std::string("\u8a9e");
// Hebrew
// text = "����;
***************
*** 334,341 ****
gldriver = new PG_VideoDriver(app, PG_DXVIDEO);
#endif
! } else if (strcmp(argv[argc-1], "--family") == 0) {
init_family = std::string(argv[argc]);
--argc;
! } else if (strcmp(argv[argc-1], "--scale") == 0) {
init_scale = atoi(argv[argc]);
--argc;
--- 390,397 ----
gldriver = new PG_VideoDriver(app, PG_DXVIDEO);
#endif
! } else if (strcmp(argv[argc-1], "-family") == 0) {
init_family = std::string(argv[argc]);
--argc;
! } else if (strcmp(argv[argc-1], "-scale") == 0) {
init_scale = atoi(argv[argc]);
--argc;
***************
*** 390,394 ****
pango_context_set_font_description (context, font_description);
};
!
if(!app.InitScreen(width, height, video_bpp, videoflags)) {
PG_LogERR("Couldn't set %dx%d video mode: %s",
--- 446,478 ----
pango_context_set_font_description (context, font_description);
};
! #if 0 /* useful for listing fonts, but buggy.... */
! {
! gint n_faces;
! gint n_families;
! PangoFontFamily* family;
! PangoFontFamily **families;
! PangoFontFace **faces;
! PangoFontFace *match_face = NULL;
! int i,j;
!
! pango_context_list_families (context, &families, &n_families);
! qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
! for (i=0; i < n_families; i++)
! {
! family = families[i];
! const gchar* fstr = pango_font_family_get_name(family);
! fprintf(stderr, "family[%i]: \'%s\'\n", i, fstr);
! pango_font_family_list_faces(family, &faces, &n_faces);
! qsort(faces, n_faces, sizeof (PangoFontFace *), faces_sort_func);
! for (j=0; j < n_faces; j++)
! {
! const gchar *str = pango_font_face_get_face_name (faces[j]);
! fprintf(stderr, "family[%i] font %i:\'%s\'\n", i, j, str);
! }
! g_free (faces);
! };
! g_free (families);
! };
! #endif
if(!app.InitScreen(width, height, video_bpp, videoflags)) {
PG_LogERR("Couldn't set %dx%d video mode: %s",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paragui-cvs] CVS: paragui/plugins/pango pango.cpp,1.1.2.2,1.1.2.3,
Teunis Peters <address@hidden> <=
- Prev by Date:
[paragui-cvs] CVS: paragui/src/draw/opengl pgglcore.cpp,1.1.2.4,1.1.2.5 pggloper.cpp,1.1.2.5,1.1.2.6 pgglsurf.cpp,1.1.2.7,1.1.2.8
- Next by Date:
[paragui-cvs] CVS: paragui/plugins/pango pango.cpp,1.1.2.3,1.1.2.4
- Previous by thread:
[paragui-cvs] CVS: paragui/src/draw/opengl pgglcore.cpp,1.1.2.4,1.1.2.5 pggloper.cpp,1.1.2.5,1.1.2.6 pgglsurf.cpp,1.1.2.7,1.1.2.8
- Next by thread:
[paragui-cvs] CVS: paragui/plugins/pango pango.cpp,1.1.2.3,1.1.2.4
- Index(es):