From 7dd5d6058e5462475de9b9626be89455d171d008 Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 30 Nov 2012 08:00:32 +0000 Subject: [PATCH] .pdfdraw git-svn-id: svn://ultimatepp.org/upp/trunk@5599 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/PdfDraw/PdfDraw.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/uppsrc/PdfDraw/PdfDraw.cpp b/uppsrc/PdfDraw/PdfDraw.cpp index 1369b4956..be2a353a1 100644 --- a/uppsrc/PdfDraw/PdfDraw.cpp +++ b/uppsrc/PdfDraw/PdfDraw.cpp @@ -108,7 +108,7 @@ void PdfDraw::PutRGColor(Color RG) void PdfDraw::PutLineWidth(int lw) { - lw = max(Nvl(lw, 0), 5); + lw = max(Nvl(lw, 0), 1); if(linewidth != lw) page << Pt(linewidth = lw) << " w\n"; } @@ -277,6 +277,10 @@ enum { FONTHEIGHT_TTF = -9999 }; void PdfDraw::DrawTextOp(int x, int y, int angle, const wchar *s, Font fnt, Color ink, int n, const int *dx) { +// DLOG("------------------"); +// DDUMP(fnt); +// DDUMP(GetTextSize(s, fnt, n).cx); +// DDUMP(WString(s, n)); if(!n) return; if(fnt.GetHeight() == 0) fnt.Height(100); @@ -360,9 +364,14 @@ void PdfDraw::DrawTextOp(int x, int y, int angle, const wchar *s, Font fnt, } page << "ET\n"; } +// DrawRect(x + posx, y, 20, 20, Black()); _DBG_ if(fnt.IsUnderline()) { - int w = ff.GetAscent() / 15; - int dy = ff.GetAscent() + max((ff.GetDescent() - w) / 2, ff.GetAscent() / 10); + int w = max(2, ff.GetAscent() / 25); + int dy = ff.GetAscent() + min(ff.GetDescent() - w, 2 * w); +// DDUMP(posx); +// DDUMP(dy); +// DDUMP(ff.GetAscent()); +// DDUMP(w); DrawLine(fround(x + sina * dy), fround(y + cosa * dy), fround(x + cosa * posx + sina * dy),