int lineSpacing = 0;
// Let's assume line spacing of 10 is normal, 15 is 1.5, 20 is 2, etc.
- if (attr.GetLineSpacing() != 10 && GetBuffer())
+ if (attr.HasLineSpacing() && attr.GetLineSpacing() > 0 && attr.GetFont().Ok())
{
- wxFont font(GetBuffer()->GetFontTable().FindFont(attr));
- wxCheckSetFont(dc, font);
- lineSpacing = (ConvertTenthsMMToPixels(dc, dc.GetCharHeight()) * attr.GetLineSpacing())/10;
+ wxCheckSetFont(dc, attr.GetFont());
+ lineSpacing = (int) (double(dc.GetCharHeight()) * (double(attr.GetLineSpacing())/10.0 - 1.0));
}
// Available space for text on each line differs.
// Apply styles to wrapped lines
ApplyParagraphStyle(attr, rect, dc);
- SetCachedSize(wxSize(maxWidth, currentPosition.y + spaceBeforePara + spaceAfterPara));
+ SetCachedSize(wxSize(maxWidth, currentPosition.y + spaceAfterPara));
m_dirty = false;
return true;
}
-inline int wxRichTextHexToDec(const char* buf)
-{
- int firstDigit, secondDigit;
-
- if (buf[0] >= 'A')
- firstDigit = buf[0] - 'A' + 10;
- else
- firstDigit = buf[0] - '0';
-
- if (buf[1] >= 'A')
- secondDigit = buf[1] - 'A' + 10;
- else
- secondDigit = buf[1] - '0';
-
- return (firstDigit & 0xF) * 16 + (secondDigit & 0xF );
-}
-
-
// Read data in hex from a stream
bool wxRichTextImageBlock::ReadHex(wxInputStream& stream, int length, wxBitmapType imageType)
{
str[0] = (char)stream.GetC();
str[1] = (char)stream.GetC();
- m_data[i] = (unsigned char)wxRichTextHexToDec(str);
+ m_data[i] = (unsigned char)wxHexToDec(str);
}
m_dataSize = dataSize;