fixed rendering of underlined text (the line may be bolder than 0 now)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1024,11 +1024,18 @@ void wxPostScriptDC::SetPen( const wxPen& pen )
|
|||||||
|
|
||||||
m_pen = pen;
|
m_pen = pen;
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
{
|
||||||
fprintf( m_pstream, "%d setlinewidth\n", XLOG2DEVREL(m_pen.GetWidth()) );
|
char buffer[100];
|
||||||
#else
|
#ifdef __WXMSW__
|
||||||
fprintf( m_pstream, "%d setlinewidth\n", XLOG2DEVREL(m_pen.GetWidth()) );
|
sprintf( buffer, "%f setlinewidth\n", XLOG2DEVREL(1000 * m_pen.GetWidth()) / 1000.0f );
|
||||||
#endif
|
#else
|
||||||
|
sprintf( buffer, "%f setlinewidth\n", XLOG2DEVREL(1000 * m_pen.GetWidth()) / 1000.0f );
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
if (buffer[i] == ',') buffer[i] = '.';
|
||||||
|
fprintf( m_pstream, buffer );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Line style - WRONG: 2nd arg is OFFSET
|
Line style - WRONG: 2nd arg is OFFSET
|
||||||
|
|
||||||
@@ -1243,17 +1250,21 @@ void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
|
|||||||
if (m_font.GetUnderlined())
|
if (m_font.GetUnderlined())
|
||||||
{
|
{
|
||||||
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
|
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
|
||||||
|
char buffer[100];
|
||||||
|
|
||||||
fprintf( m_pstream,
|
sprintf( buffer,
|
||||||
"gsave\n"
|
"gsave\n"
|
||||||
"%d %d moveto\n"
|
"%d %d moveto\n"
|
||||||
"%d setlinewidth\n"
|
"%f setlinewidth\n"
|
||||||
"%d %d lineto\n"
|
"%d %d lineto\n"
|
||||||
"stroke\n"
|
"stroke\n"
|
||||||
"grestore\n",
|
"grestore\n",
|
||||||
XLOG2DEV(x), YLOG2DEV(uy),
|
XLOG2DEV(x), YLOG2DEV(uy),
|
||||||
(wxCoord)m_underlineThickness,
|
m_underlineThickness,
|
||||||
XLOG2DEV(x + text_w), YLOG2DEV(uy) );
|
XLOG2DEV(x + text_w), YLOG2DEV(uy) );
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
if (buffer[i] == ',') buffer[i] = '.';
|
||||||
|
fprintf( m_pstream, buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
CalcBoundingBox( x, y );
|
CalcBoundingBox( x, y );
|
||||||
@@ -1367,18 +1378,22 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
|
|||||||
{
|
{
|
||||||
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
|
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
|
||||||
wxCoord w, h;
|
wxCoord w, h;
|
||||||
|
char buffer[100];
|
||||||
GetTextExtent(text, &w, &h);
|
GetTextExtent(text, &w, &h);
|
||||||
|
|
||||||
fprintf( m_pstream,
|
sprintf( buffer,
|
||||||
"gsave\n"
|
"gsave\n"
|
||||||
"%d %d moveto\n"
|
"%d %d moveto\n"
|
||||||
"%ld setlinewidth\n"
|
"%f setlinewidth\n"
|
||||||
"%d %d lineto\n"
|
"%d %d lineto\n"
|
||||||
"stroke\n"
|
"stroke\n"
|
||||||
"grestore\n",
|
"grestore\n",
|
||||||
XLOG2DEV(x), YLOG2DEV(uy),
|
XLOG2DEV(x), YLOG2DEV(uy),
|
||||||
(long)m_underlineThickness,
|
m_underlineThickness,
|
||||||
XLOG2DEV(x + w), YLOG2DEV(uy) );
|
XLOG2DEV(x + w), YLOG2DEV(uy) );
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
if (buffer[i] == ',') buffer[i] = '.';
|
||||||
|
fprintf( m_pstream, buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
CalcBoundingBox( x, y );
|
CalcBoundingBox( x, y );
|
||||||
@@ -2104,18 +2119,19 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
|
|||||||
lastWidths[220] = lastWidths['U']; // <20>
|
lastWidths[220] = lastWidths['U']; // <20>
|
||||||
lastWidths[252] = lastWidths['u']; // <20>
|
lastWidths[252] = lastWidths['u']; // <20>
|
||||||
lastWidths[223] = lastWidths[251]; // <20>
|
lastWidths[223] = lastWidths[251]; // <20>
|
||||||
}
|
|
||||||
|
|
||||||
/* JC: calculate UnderlineThickness/UnderlinePosition */
|
/* JC: calculate UnderlineThickness/UnderlinePosition */
|
||||||
{
|
|
||||||
// VS: dirty, but is there any better solution?
|
// VS: dirty, but is there any better solution?
|
||||||
double *pt;
|
double *pt;
|
||||||
pt = (double*) &m_underlinePosition;
|
pt = (double*) &m_underlinePosition;
|
||||||
*pt = UnderlinePosition * fontToUse->GetPointSize() / 1000.0f;
|
*pt = YLOG2DEVREL(UnderlinePosition * fontToUse->GetPointSize()) / 1000.0f;
|
||||||
pt = (double*) &m_underlineThickness;
|
pt = (double*) &m_underlineThickness;
|
||||||
*pt = UnderlineThickness * fontToUse->GetPointSize() / 1000.0f;
|
*pt = YLOG2DEVREL(UnderlineThickness * fontToUse->GetPointSize()) / 1000.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 3. now the font metrics are read in, calc size this
|
/* 3. now the font metrics are read in, calc size this
|
||||||
/ is done by adding the widths of the characters in the
|
/ is done by adding the widths of the characters in the
|
||||||
/ string. they are given in 1/1000 of the size! */
|
/ string. they are given in 1/1000 of the size! */
|
||||||
|
Reference in New Issue
Block a user