summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-12-28 12:45:28 +0000
committerManolo Gouy <Manolo>2010-12-28 12:45:28 +0000
commit64dd2cfa6836c4e590624bb2c95e59343f7fa8c0 (patch)
treede6e7812ea2b7d9002ff3ebf39618b28794ff77c /src
parentb431c1e0e7cec74dfe55d558a42a0f162079b0c1 (diff)
Added right-to-left text drawing to PostScript graphics driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8127 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_PostScript.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Fl_PostScript.cxx b/src/Fl_PostScript.cxx
index bcf14e5a3..2e3abfd23 100644
--- a/src/Fl_PostScript.cxx
+++ b/src/Fl_PostScript.cxx
@@ -1094,6 +1094,25 @@ void Fl_PostScript_Graphics_Driver::transformed_draw(const char* str, int n, dou
fprintf(output, "> %g %g show_pos_width\n", x, y);
}
+void Fl_PostScript_Graphics_Driver::rtl_draw(const char* str, int n, int x, int y) {
+ const char *last = str + n;
+ const char *str2 = str;
+ unsigned unis[n + 1];
+ char out[n + 1];
+ int u = 0, len;
+ char *p = out;
+ double w = fl_width(str, n);
+ while (str2 < last) {
+ unis[u++] = fl_utf8decode(str2, last, &len);
+ str2 += len;
+ }
+ while (u > 0) {
+ len = fl_utf8encode(unis[--u], p);
+ p += len;
+ }
+ transformed_draw(out, p - out, x - w, y);
+}
+
struct matrix {double a, b, c, d, x, y;};
extern matrix * fl_matrix;