long len = range.GetLength();
wxString stringChunk = str.Mid(range.GetStart() - offset, (size_t) len);
- int charHeight = dc.GetCharHeight();
-
- int x = rect.x;
- int y = rect.y + (rect.height - charHeight - (descent - m_descent));
-
// Test for the optimized situations where all is selected, or none
// is selected.
- wxFont font(GetBuffer()->GetFontTable().FindFont(textAttr));
- wxCheckSetFont(dc, font);
+ wxFont textFont(GetBuffer()->GetFontTable().FindFont(textAttr));
+ wxCheckSetFont(dc, textFont);
+ int charHeight = dc.GetCharHeight();
+
+ int x, y;
+ if ( textFont.Ok() )
+ {
+ if ( textAttr.HasTextEffects() && (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT) )
+ {
+ double size = static_cast<double>(textFont.GetPointSize()) / wxSCRIPT_MUL_FACTOR;
+ textFont.SetPointSize( static_cast<int>(size) );
+ x = rect.x;
+ y = rect.y;
+ wxCheckSetFont(dc, textFont);
+ }
+ else if ( textAttr.HasTextEffects() && (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT) )
+ {
+ double size = static_cast<double>(textFont.GetPointSize()) / wxSCRIPT_MUL_FACTOR;
+ textFont.SetPointSize( static_cast<int>(size) );
+ x = rect.x;
+ int sub_height = static_cast<int>( static_cast<double>(charHeight) / wxSCRIPT_MUL_FACTOR);
+ y = rect.y + (rect.height - sub_height + (descent - m_descent));
+ wxCheckSetFont(dc, textFont);
+ }
+ else
+ {
+ x = rect.x;
+ y = rect.y + (rect.height - charHeight - (descent - m_descent));
+ }
+ }
+ else
+ {
+ x = rect.x;
+ y = rect.y + (rect.height - charHeight - (descent - m_descent));
+ }
// (a) All selected.
if (selectionRange.GetStart() <= range.GetStart() && selectionRange.GetEnd() >= range.GetEnd())
// (c) Part selected, part not
// Let's draw unselected chunk, selected chunk, then unselected chunk.
- dc.SetBackgroundMode(wxTRANSPARENT);
+ dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
// 1. Initial unselected chunk, if any, up until start of selection.
if (selectionRange.GetStart() > range.GetStart() && selectionRange.GetStart() <= range.GetEnd())
wxCheckSetBrush(dc, wxBrush(highlightColour));
wxCheckSetPen(dc, wxPen(highlightColour));
dc.SetTextForeground(highlightTextColour);
- dc.SetBackgroundMode(wxTRANSPARENT);
+ dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
}
else
{
if (attr.HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) && attr.GetBackgroundColour().IsOk())
{
- dc.SetBackgroundMode(wxSOLID);
+ dc.SetBackgroundMode(wxBRUSHSTYLE_SOLID);
dc.SetTextBackground(attr.GetBackgroundColour());
}
else
- dc.SetBackgroundMode(wxTRANSPARENT);
+ dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
}
while (hasTabs)
// of line breaks - and we don't need it, since we'll calculate size within
// formatted text by doing it in chunks according to the line ranges
+ bool bScript(false);
wxFont font(GetBuffer()->GetFontTable().FindFont(textAttr));
- wxCheckSetFont(dc, font);
+ if (font.Ok())
+ {
+ if ( textAttr.HasTextEffects() && ( (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT)
+ || (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT) ) )
+ {
+ wxFont textFont = font;
+ double size = static_cast<double>(textFont.GetPointSize()) / wxSCRIPT_MUL_FACTOR;
+ textFont.SetPointSize( static_cast<int>(size) );
+ wxCheckSetFont(dc, textFont);
+ bScript = true;
+ }
+ else
+ {
+ wxCheckSetFont(dc, font);
+ }
+ }
int startPos = range.GetStart() - GetRange().GetStart();
long len = range.GetLength();
}
}
}
+
dc.GetTextExtent(stringChunk, & w, & h, & descent);
width += w;
+
+ if ( bScript )
+ dc.SetFont(font);
+
size = wxSize(width, dc.GetCharHeight());
return true;
if (attr.GetTextColour().Ok())
dc.SetTextForeground(attr.GetTextColour());
- dc.SetBackgroundMode(wxTRANSPARENT);
+ dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
int charHeight = dc.GetCharHeight();
wxCoord tw, th;