DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1840
Version: 1.2-feature
Fix Version: None


I've made a rotated text patch for xft fonts (I can write it for win32).

it change void fl_font(int face,int size) call.
int fl_font(int face,int size, double (or int) angle=0).

I test it on Linux. (can test it on win32).

But I have no idia for no-xft fonts. i have no macos.
And i can suppose that for APLE_QARTS it's easy (as i see in code).

If onyone wants this feature and can help on macos and no-xft (or maybe
exclude this for no-xft fonts?) i can commit this changes.

Any comments please.

P.S.
path for fltk-1.1.8-utf-8. but I can adapt it for current 1.1 svn (or) 2.0
svn


Link: http://www.fltk.org/str.php?L1840
Version: 1.2-feature
Fix Version: None
diff -urwN fltk118-utf8-2007-10-11/FL/fl_draw.H 
fltk118-utf8-2007-10-11.rot/FL/fl_draw.H
--- fltk118-utf8-2007-10-11/FL/fl_draw.H        2007-06-17 19:14:21.000000000 
+0400
+++ fltk118-utf8-2007-10-11.rot/FL/fl_draw.H    2007-11-17 01:00:35.000000000 
+0300
@@ -136,11 +136,13 @@
 FL_EXPORT void fl_transformed_vertex(double x, double y);
 
 // current font:
-FL_EXPORT void fl_font(int face, int size);
+FL_EXPORT void fl_font(int face, int size,int angle=0);
 extern FL_EXPORT int fl_font_;
 inline int fl_font() {return fl_font_;}
 extern FL_EXPORT int fl_size_;
 inline int fl_size() {return fl_size_;}
+extern FL_EXPORT int fl_angle_;
+inline int fl_angle() {return fl_angle_;}
 
 // information you can get about the current font:
 FL_EXPORT int   fl_height();   // using "size" should work ok
diff -urwN fltk118-utf8-2007-10-11/src/Fl_Font.H 
fltk118-utf8-2007-10-11.rot/src/Fl_Font.H
--- fltk118-utf8-2007-10-11/src/Fl_Font.H       2007-06-27 00:40:33.000000000 
+0400
+++ fltk118-utf8-2007-10-11.rot/src/Fl_Font.H   2007-11-17 00:51:34.000000000 
+0300
@@ -73,6 +73,7 @@
   XftFont* font;
 //  const char* encoding;
   int size;
+  int angle;
   FL_EXPORT Fl_FontSize(const char* xfontname);
 #  else
   XUtf8FontStruct* font;       // X UTF-8 font information
diff -urwN fltk118-utf8-2007-10-11/src/fl_font_xft.cxx 
fltk118-utf8-2007-10-11.rot/src/fl_font_xft.cxx
--- fltk118-utf8-2007-10-11/src/fl_font_xft.cxx 2007-10-11 23:24:58.000000000 
+0400
+++ fltk118-utf8-2007-10-11.rot/src/fl_font_xft.cxx     2007-11-17 
01:09:00.000000000 +0300
@@ -90,6 +90,7 @@
 
 int fl_font_ = 0;
 int fl_size_ = 0;
+int fl_angle_ = 0;
 //XFontStruct* fl_xfont = 0;
 XUtf8FontStruct* fl_xfont = 0;
 void *fl_xftfont = 0;
@@ -97,21 +98,21 @@
 const char* fl_encoding_ = "iso10646-1";
 Fl_FontSize* fl_fontsize = 0;
 
-void fl_font(int fnum, int size) {
+void fl_font(int fnum, int size,int angle) {
   if (fnum==-1) { // special case to stop font caching
-    fl_font_ = 0; fl_size_ = 0;
+    fl_font_ = 0; fl_size_ = 0; fl_angle_ = 0;
     return;
   }
-  if (fnum == fl_font_ && size == fl_size_
+  if (fnum == fl_font_ && size == fl_size_ && angle == fl_angle_
       && fl_fontsize)
 //      && !strcasecmp(fl_fontsize->encoding, fl_encoding_))
     return;
-  fl_font_ = fnum; fl_size_ = size;
+  fl_font_ = fnum; fl_size_ = size; fl_angle_ = angle;
   Fl_Fontdesc *font = fl_fonts + fnum;
   Fl_FontSize* f;
   // search the fontsizes we have generated already
   for (f = font->first; f; f = f->next) {
-    if (f->size == size)// && !strcasecmp(f->encoding, fl_encoding_))
+    if (f->size == size && f->angle == angle)// && !strcasecmp(f->encoding, 
fl_encoding_))
       break;
   }
   if (!f) {
@@ -126,6 +127,8 @@
   fl_xftfont = (void*)f->font;
 }
 
+#include <math.h>
+
 static XftFont* fontopen(const char* name, bool core) {
 //printf("in fontopen, :%s: %d\n", name, (int)core);
 
@@ -207,6 +210,12 @@
     XftPatternAddInteger(fnt_pat, XFT_SLANT, slant);
     XftPatternAddDouble (fnt_pat, XFT_PIXEL_SIZE, (double)fl_size_);
     XftPatternAddString (fnt_pat, XFT_ENCODING, fl_encoding_);
+    if(fl_angle_!=0){
+    XftMatrix m;
+    XftMatrixInit(&m);
+    XftMatrixRotate(&m,cos(M_PI*fl_angle_/180.),sin(M_PI*fl_angle_/180.));
+    XftPatternAddMatrix (fnt_pat, XFT_MATRIX,&m);
+    }
 #if XFT_MAJOR < 2
     if(core) XftPatternAddBool(fnt_pat, XFT_CORE, FcTrue);
 #else
@@ -297,6 +306,7 @@
 Fl_FontSize::Fl_FontSize(const char* name) {
 //  encoding = fl_encoding_;
   size = fl_size_;
+  angle = fl_angle_;
 #if HAVE_GL
   listbase = 0;
 #endif // HAVE_GL
diff -urwN fltk118-utf8-2007-10-11/xutf8/Makefile 
fltk118-utf8-2007-10-11.rot/xutf8/Makefile
--- fltk118-utf8-2007-10-11/xutf8/Makefile      2007-06-16 12:48:25.000000000 
+0400
+++ fltk118-utf8-2007-10-11.rot/xutf8/Makefile  2007-11-11 01:56:02.000000000 
+0300
@@ -25,7 +25,8 @@
 
 include ../makeinclude
 
-
+MKDIR = mkdir -p
+CP=cp 
 #
 # Object files... set this based on the operating system and host
 #
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to