diff --git a/uppsrc/DocTypes/QtfCtrl.cpp b/uppsrc/DocTypes/QtfCtrl.cpp index e5b8cb8d1..f6b5f0602 100644 --- a/uppsrc/DocTypes/QtfCtrl.cpp +++ b/uppsrc/DocTypes/QtfCtrl.cpp @@ -35,7 +35,7 @@ int QtfCtrl::GetHeight(int cx) const { return doc.GetHeight(zoom, cx, cache); } -Draw& ScreenInfo(); +SystemDraw& ScreenInfo(); void QtfCtrl::Layout() { Size sz = sb.GetViewSize(); diff --git a/uppsrc/DocTypes/RtfDocOut.cpp b/uppsrc/DocTypes/RtfDocOut.cpp index 75b73bd1b..6ded8dadc 100644 --- a/uppsrc/DocTypes/RtfDocOut.cpp +++ b/uppsrc/DocTypes/RtfDocOut.cpp @@ -34,7 +34,7 @@ void RtfDocOut::Border(const char *cmd, int width, dword color) { } } -Draw& ScreenInfo(); +SystemDraw& ScreenInfo(); void RtfDocOut::PutPicture(const Drawing& iw, Size sz) { #ifdef PLATFORM_WIN32 diff --git a/uppsrc/Ole/Ctrl/util.cpp b/uppsrc/Ole/Ctrl/util.cpp index d81136573..01050ab99 100644 --- a/uppsrc/Ole/Ctrl/util.cpp +++ b/uppsrc/Ole/Ctrl/util.cpp @@ -6,7 +6,7 @@ NAMESPACE_UPP enum { HIMETRIC_INCH = 2540 }; // HIMETRIC units per inch -Draw& ScreenInfo(); +SystemDraw& ScreenInfo(); Size ToHiMetric(Size pixel_size) { diff --git a/uppsrc/Painter/FontX11.cpp b/uppsrc/Painter/FontX11.cpp index a5a1fde57..6ba77b2de 100644 --- a/uppsrc/Painter/FontX11.cpp +++ b/uppsrc/Painter/FontX11.cpp @@ -1,157 +1,159 @@ -//---------------------------------------------------------------------------- -// Anti-Grain Geometry - Version 2.4 -// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all coM_PIes. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -//---------------------------------------------------------------------------- -// Contact: mcseem@antigrain.com -// mcseemagg@yahoo.com -// http://www.antigrain.com -//---------------------------------------------------------------------------- - -// Recycled for U++ by Miroslav Fidler 2008 - -#include "Painter.h" - -#include -#include - -NAMESPACE_UPP - -#ifdef PLATFORM_X11 - -FT_Face FTFace(Font fnt, String *rpath); - -static inline double ft_dbl(int p) -{ - return double(p) / 64.0; -} - -bool RenderOutline(const FT_Outline& outline, Painter& path, double xx, double yy) -{ - FT_Vector v_last; - FT_Vector v_control; - FT_Vector v_start; - double x1, y1, x2, y2, x3, y3; - FT_Vector* point; - FT_Vector* limit; - char* tags; - int n; // index of contour in outline - char tag; // current point's state - int first = 0; // index of first point in contour - for(n = 0; n < outline.n_contours; n++) { - int last = outline.contours[n]; - limit = outline.points + last; - v_start = outline.points[first]; - v_last = outline.points[last]; - v_control = v_start; - point = outline.points + first; - tags = outline.tags + first; - tag = FT_CURVE_TAG(tags[0]); - if(tag == FT_CURVE_TAG_CUBIC) return false; - if(tag == FT_CURVE_TAG_CONIC) { - if(FT_CURVE_TAG(outline.tags[last]) == FT_CURVE_TAG_ON) { - // start at last point if it is on the curve - v_start = v_last; - limit--; - } - else { - // if both first and last points are conic, - // start at their middle and record its position - // for closure - v_start.x = (v_start.x + v_last.x) / 2; - v_start.y = (v_start.y + v_last.y) / 2; - v_last = v_start; - } - point--; - tags--; - } - path.Move(ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy); - while(point < limit) { - point++; - tags++; - - tag = FT_CURVE_TAG(tags[0]); - switch(tag) { - case FT_CURVE_TAG_ON: - path.Line(ft_dbl(point->x) + xx, -ft_dbl(point->y) + yy); - continue; - case FT_CURVE_TAG_CONIC: - v_control.x = point->x; - v_control.y = point->y; - Do_Conic: - if(point < limit) { - FT_Vector vec; - FT_Vector v_middle; - point++; - tags++; - tag = FT_CURVE_TAG(tags[0]); - vec.x = point->x; - vec.y = point->y; - if(tag == FT_CURVE_TAG_ON) { - path.Quadratic(ft_dbl(v_control.x) + xx, -ft_dbl(v_control.y) + yy, - ft_dbl(vec.x) + xx, -ft_dbl(vec.y) + yy); - continue; - } - if(tag != FT_CURVE_TAG_CONIC) return false; - v_middle.x = (v_control.x + vec.x) / 2; - v_middle.y = (v_control.y + vec.y) / 2; - path.Quadratic(ft_dbl(v_control.x) + xx, -ft_dbl(v_control.y) + yy, - ft_dbl(v_middle.x) + xx, -ft_dbl(v_middle.y) + yy); - v_control = vec; - goto Do_Conic; - } - path.Quadratic(ft_dbl(v_control.x) + xx, -ft_dbl(v_control.y) + yy, - ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy); - goto Close; - - default: - FT_Vector vec1, vec2; - if(point + 1 > limit || FT_CURVE_TAG(tags[1]) != FT_CURVE_TAG_CUBIC) - return false; - vec1.x = point[0].x; - vec1.y = point[0].y; - vec2.x = point[1].x; - vec2.y = point[1].y; - point += 2; - tags += 2; - if(point <= limit) { - FT_Vector vec; - vec.x = point->x; - vec.y = point->y; - path.Cubic(ft_dbl(vec1.x) + xx, -ft_dbl(vec1.y) + yy, - ft_dbl(vec2.x) + xx, -ft_dbl(vec2.y) + yy, - ft_dbl(vec.x) + xx, -ft_dbl(vec.y) + yy); - continue; - } - path.Cubic(ft_dbl(vec1.x) + xx, -ft_dbl(vec1.y) + yy, - ft_dbl(vec2.x) + xx, -ft_dbl(vec2.y) + yy, - ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy); - goto Close; - } - } - Close: - path.Close(); - first = last + 1; - } - return true; -} - -void PaintCharacterSys(Painter& sw, double x, double y, int ch, Font fnt) -{ - DrawLock __; - PAINTER_TIMING("CharacterOp"); - FT_Face face = FTFace(fnt, NULL); - int glyph_index = FT_Get_Char_Index(face, ch); - if(glyph_index && FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT) == 0) - RenderOutline(face->glyph->outline, sw, x, y + fnt.GetAscent()); - sw.EvenOdd(true); -} - -#endif - -END_UPP_NAMESPACE +//---------------------------------------------------------------------------- +// Anti-Grain Geometry - Version 2.4 +// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all coM_PIes. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +//---------------------------------------------------------------------------- +// Contact: mcseem@antigrain.com +// mcseemagg@yahoo.com +// http://www.antigrain.com +//---------------------------------------------------------------------------- + +// Recycled for U++ by Miroslav Fidler 2008 + +#include "Painter.h" + +#ifdef PLATFORM_X11 +#include +#include +#endif + +NAMESPACE_UPP + +#ifdef PLATFORM_X11 + +FT_Face FTFace(Font fnt, String *rpath); + +static inline double ft_dbl(int p) +{ + return double(p) / 64.0; +} + +bool RenderOutline(const FT_Outline& outline, Painter& path, double xx, double yy) +{ + FT_Vector v_last; + FT_Vector v_control; + FT_Vector v_start; + double x1, y1, x2, y2, x3, y3; + FT_Vector* point; + FT_Vector* limit; + char* tags; + int n; // index of contour in outline + char tag; // current point's state + int first = 0; // index of first point in contour + for(n = 0; n < outline.n_contours; n++) { + int last = outline.contours[n]; + limit = outline.points + last; + v_start = outline.points[first]; + v_last = outline.points[last]; + v_control = v_start; + point = outline.points + first; + tags = outline.tags + first; + tag = FT_CURVE_TAG(tags[0]); + if(tag == FT_CURVE_TAG_CUBIC) return false; + if(tag == FT_CURVE_TAG_CONIC) { + if(FT_CURVE_TAG(outline.tags[last]) == FT_CURVE_TAG_ON) { + // start at last point if it is on the curve + v_start = v_last; + limit--; + } + else { + // if both first and last points are conic, + // start at their middle and record its position + // for closure + v_start.x = (v_start.x + v_last.x) / 2; + v_start.y = (v_start.y + v_last.y) / 2; + v_last = v_start; + } + point--; + tags--; + } + path.Move(ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy); + while(point < limit) { + point++; + tags++; + + tag = FT_CURVE_TAG(tags[0]); + switch(tag) { + case FT_CURVE_TAG_ON: + path.Line(ft_dbl(point->x) + xx, -ft_dbl(point->y) + yy); + continue; + case FT_CURVE_TAG_CONIC: + v_control.x = point->x; + v_control.y = point->y; + Do_Conic: + if(point < limit) { + FT_Vector vec; + FT_Vector v_middle; + point++; + tags++; + tag = FT_CURVE_TAG(tags[0]); + vec.x = point->x; + vec.y = point->y; + if(tag == FT_CURVE_TAG_ON) { + path.Quadratic(ft_dbl(v_control.x) + xx, -ft_dbl(v_control.y) + yy, + ft_dbl(vec.x) + xx, -ft_dbl(vec.y) + yy); + continue; + } + if(tag != FT_CURVE_TAG_CONIC) return false; + v_middle.x = (v_control.x + vec.x) / 2; + v_middle.y = (v_control.y + vec.y) / 2; + path.Quadratic(ft_dbl(v_control.x) + xx, -ft_dbl(v_control.y) + yy, + ft_dbl(v_middle.x) + xx, -ft_dbl(v_middle.y) + yy); + v_control = vec; + goto Do_Conic; + } + path.Quadratic(ft_dbl(v_control.x) + xx, -ft_dbl(v_control.y) + yy, + ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy); + goto Close; + + default: + FT_Vector vec1, vec2; + if(point + 1 > limit || FT_CURVE_TAG(tags[1]) != FT_CURVE_TAG_CUBIC) + return false; + vec1.x = point[0].x; + vec1.y = point[0].y; + vec2.x = point[1].x; + vec2.y = point[1].y; + point += 2; + tags += 2; + if(point <= limit) { + FT_Vector vec; + vec.x = point->x; + vec.y = point->y; + path.Cubic(ft_dbl(vec1.x) + xx, -ft_dbl(vec1.y) + yy, + ft_dbl(vec2.x) + xx, -ft_dbl(vec2.y) + yy, + ft_dbl(vec.x) + xx, -ft_dbl(vec.y) + yy); + continue; + } + path.Cubic(ft_dbl(vec1.x) + xx, -ft_dbl(vec1.y) + yy, + ft_dbl(vec2.x) + xx, -ft_dbl(vec2.y) + yy, + ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy); + goto Close; + } + } + Close: + path.Close(); + first = last + 1; + } + return true; +} + +void PaintCharacterSys(Painter& sw, double x, double y, int ch, Font fnt) +{ + DrawLock __; + PAINTER_TIMING("CharacterOp"); + FT_Face face = FTFace(fnt, NULL); + int glyph_index = FT_Get_Char_Index(face, ch); + if(glyph_index && FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT) == 0) + RenderOutline(face->glyph->outline, sw, x, y + fnt.GetAscent()); + sw.EvenOdd(true); +} + +#endif + +END_UPP_NAMESPACE diff --git a/uppsrc/Painter/init b/uppsrc/Painter/init index 8afab654c..ad1a29872 100644 --- a/uppsrc/Painter/init +++ b/uppsrc/Painter/init @@ -2,7 +2,7 @@ #define _Painter_icpp_init_stub #include "Core/init" #include "CtrlLib/init" -#define BLITZ_INDEX__ FE26D1A011428E19BAEAFE2F1E9FA2F00 +#define BLITZ_INDEX__ FBF07B7CD14210990A670603EF0FC04FB #include "PaintPainting.icpp" #undef BLITZ_INDEX__ #endif diff --git a/uppsrc/TCtrlLib/Help/helputil.cpp b/uppsrc/TCtrlLib/Help/helputil.cpp index d63a61c50..9dd75d2c9 100644 --- a/uppsrc/TCtrlLib/Help/helputil.cpp +++ b/uppsrc/TCtrlLib/Help/helputil.cpp @@ -1073,7 +1073,7 @@ public: virtual void Paint(Draw& draw, const Rect& rc, const Value& v, Color ink, Color paper, dword style) const; struct RTDPageDraw : public PageDraw { - virtual Draw& Page(int _page) { return _page ? ScreenInfo() : w; } + virtual Draw& Page(int _page) { return _page ? (Draw&)ScreenInfo() : w; } virtual Draw& Info() { return w; } Draw& w; diff --git a/uppsrc/TDraw/TDraw.h b/uppsrc/TDraw/TDraw.h index f30e24e5f..43469df96 100644 --- a/uppsrc/TDraw/TDraw.h +++ b/uppsrc/TDraw/TDraw.h @@ -1,7 +1,7 @@ #ifndef __TDraw__ #define __TDraw__ -#include +#include #include #include diff --git a/uppsrc/ide/Browser/TopicWin.cpp b/uppsrc/ide/Browser/TopicWin.cpp index da3b0af8d..d77bca9e6 100644 --- a/uppsrc/ide/Browser/TopicWin.cpp +++ b/uppsrc/ide/Browser/TopicWin.cpp @@ -118,8 +118,7 @@ void TopicEditor::SyncFonts() ff.Add(Font::COURIER); if(allfonts) for(int i = Font::COURIER + 1; i < Font::GetFaceCount(); i++) - if(Font::GetFaceInfo(i) & Font::SCALEABLE && - !(Font::GetFaceInfo(i) & Font::SYMBOLTYPE)) + if(Font::GetFaceInfo(i) & Font::SCALEABLE) ff.Add(i); editor.FontFaces(ff); }