* Make wxWindow::SetFont call wxWindowBase::SetFont.
* Make wxDC::SetFont store the font in existing m_font.
* Make wxFont::GetUnderlined return the m_underlined flag.
* Implement underlining in wxDC::DoDrawText
Copyright 2007, Software 2000 Ltd.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47598
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void StartPage(void) {};
virtual void EndPage(void) {};
virtual void StartPage(void) {};
virtual void EndPage(void) {};
- virtual void SetFont(const wxFont& font) {}
+ virtual void SetFont(const wxFont& font);
virtual void SetPen(const wxPen& pen);
virtual void SetBrush(const wxBrush& brush);
virtual void SetBackground(const wxBrush& brush);
virtual void SetPen(const wxPen& pen);
virtual void SetBrush(const wxBrush& brush);
virtual void SetBackground(const wxBrush& brush);
NSPoint layoutLocation = [sm_cocoaNSLayoutManager locationForGlyphAtIndex:0];
layoutLocation.x = 0.0;
layoutLocation.y *= -1.0;
NSPoint layoutLocation = [sm_cocoaNSLayoutManager locationForGlyphAtIndex:0];
layoutLocation.x = 0.0;
layoutLocation.y *= -1.0;
+
+ // Save the location as is for underlining
+ NSPoint underlineLocation = layoutLocation;
+
+ // Offset the location by the baseline for drawing the glyphs.
layoutLocation.y += [[sm_cocoaNSLayoutManager typesetter] baselineOffsetInLayoutManager:sm_cocoaNSLayoutManager glyphIndex:0];
layoutLocation.y += [[sm_cocoaNSLayoutManager typesetter] baselineOffsetInLayoutManager:sm_cocoaNSLayoutManager glyphIndex:0];
if(m_backgroundMode==wxSOLID)
[sm_cocoaNSLayoutManager drawBackgroundForGlyphRange:glyphRange atPoint:NSZeroPoint];
[sm_cocoaNSLayoutManager drawGlyphsForGlyphRange:glyphRange atPoint:layoutLocation];
if(m_backgroundMode==wxSOLID)
[sm_cocoaNSLayoutManager drawBackgroundForGlyphRange:glyphRange atPoint:NSZeroPoint];
[sm_cocoaNSLayoutManager drawGlyphsForGlyphRange:glyphRange atPoint:layoutLocation];
+ int underlineStyle = GetFont().GetUnderlined() ? NSUnderlineStyleSingle : NSUnderlineStyleNone;
+ NSRange lineGlyphRange;
+ NSRect lineRect = [sm_cocoaNSLayoutManager lineFragmentRectForGlyphAtIndex:0 effectiveRange:&lineGlyphRange];
+
+ [sm_cocoaNSLayoutManager underlineGlyphRange:glyphRange underlineType:underlineStyle
+ lineFragmentRect:lineRect lineFragmentGlyphRange:lineGlyphRange
+ containerOrigin:underlineLocation];
+
[context restoreGraphicsState];
}
[context restoreGraphicsState];
}
+void wxDC::SetFont(const wxFont& font)
+{
+ m_font = font;
+}
+
void wxDC::SetPen(const wxPen& pen)
{
m_pen = pen;
void wxDC::SetPen(const wxPen& pen)
{
m_pen = pen;
bool wxFont::GetUnderlined() const
{
bool wxFont::GetUnderlined() const
{
+ if(M_FONTDATA)
+ return M_FONTDATA->m_underlined;
+ else
+ return false;
}
int wxFont::GetStyle() const
}
int wxFont::GetStyle() const
bool wxWindow::SetFont(const wxFont& font)
{
bool wxWindow::SetFont(const wxFont& font)
{
+ // FIXME: We may need to handle wx font inheritance.
+ return wxWindowBase::SetFont(font);
}
#if 0 // these are used when debugging the algorithm.
}
#if 0 // these are used when debugging the algorithm.