mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[kandinsky | code] Coding style improvement in the new font (part 1)
This commit is contained in:
@@ -111,12 +111,10 @@ protected:
|
||||
m_cursorLocation = m_text.text();
|
||||
}
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
void drawStringAt(KDContext * ctx, int line, int column, const char * text, int length, KDColor textColor, KDColor backgroundColor, const char * selectionStart, const char * selectionEnd, KDColor backgroundHighlightColor,bool isItalic = false) const;
|
||||
void drawStringAt(KDContext * ctx, int line, int column, const char * text, int length, KDColor textColor, KDColor backgroundColor, const char * selectionStart, const char * selectionEnd, KDColor backgroundHighlightColor, bool isItalic = false) const;
|
||||
virtual void drawLine(KDContext * ctx, int line, const char * text, size_t length, int fromColumn, int toColumn, const char * selectionStart, const char * selectionEnd) const = 0;
|
||||
virtual void clearRect(KDContext * ctx, KDRect rect) const = 0;
|
||||
KDSize minimalSizeForOptimalDisplay() const override;
|
||||
KDFont * usedFont;
|
||||
KDFont * ItalicFont;
|
||||
void setText(char * textBuffer, size_t textBufferSize);
|
||||
const char * text() const override { return m_text.text(); }
|
||||
const char * editedText() const override { return m_text.text(); }
|
||||
|
||||
@@ -516,13 +516,15 @@ void TextArea::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
void TextArea::ContentView::drawStringAt(KDContext * ctx, int line, int column, const char * text, int length, KDColor textColor, KDColor backgroundColor, const char * selectionStart, const char * selectionEnd, KDColor backgroundHighlightColor, bool isItalic) const {
|
||||
if (length < 0) {
|
||||
return;
|
||||
}
|
||||
const KDFont * ItalicFont = (m_font == KDFont::LargeFont) ? KDFont::ItalicLargeFont : KDFont::ItalicSmallFont;
|
||||
const KDFont * usedFont = isItalic ? ItalicFont : m_font;
|
||||
|
||||
|
||||
}
|
||||
|
||||
const KDFont * usedFont = m_font;
|
||||
if (isItalic) {
|
||||
usedFont = m_font->toItalic();
|
||||
}
|
||||
|
||||
KDSize glyphSize = usedFont->glyphSize();
|
||||
|
||||
|
||||
bool drawSelection = selectionStart != nullptr && selectionEnd > text && selectionStart < text + length;
|
||||
|
||||
KDPoint nextPoint = ctx->drawString(
|
||||
@@ -563,7 +565,7 @@ KDSize TextArea::ContentView::minimalSizeForOptimalDisplay() const {
|
||||
return KDSize(
|
||||
/* We take into account the space required to draw a cursor at the end of
|
||||
* line by adding glyphSize.width() to the width. */
|
||||
span.width() + m_font->glyphSize().width() + 4,
|
||||
span.width() + m_font->glyphSize().width(),
|
||||
span.height()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user