diff --git a/apps/calculation/text_field.cpp b/apps/calculation/text_field.cpp index e47e5e89a..3f0e999e8 100644 --- a/apps/calculation/text_field.cpp +++ b/apps/calculation/text_field.cpp @@ -3,7 +3,7 @@ namespace Calculation { TextField::TextField(Responder * parentResponder, char * textBuffer, size_t textBufferSize, TextFieldDelegate * delegate) : - ::TextField(parentResponder, textBuffer, textBuffer, textBufferSize, KDText::FontSize::Large, delegate) + ::TextField(parentResponder, textBuffer, textBuffer, textBufferSize, delegate) { m_isEditing = true; } diff --git a/apps/curve_view.cpp b/apps/curve_view.cpp index b7b14dd19..66c3029b9 100644 --- a/apps/curve_view.cpp +++ b/apps/curve_view.cpp @@ -105,7 +105,7 @@ void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOr origin = KDPoint(floatToPixel(Axis::Horizontal, 0.0f) + k_labelMargin, floatToPixel(Axis::Vertical, 0.0f) + k_labelMargin); } if (rect.intersects(KDRect(origin, KDText::stringSize(label(axis, i), KDText::FontSize::Small)))) { - ctx->blendString(label(axis, i), KDText::FontSize::Small, origin, KDColorBlack); + ctx->blendString(label(axis, i), origin, KDText::FontSize::Small, KDColorBlack); } i++; } diff --git a/apps/graph/function_title_cell.h b/apps/graph/function_title_cell.h index 956f360b9..f1201fdcf 100644 --- a/apps/graph/function_title_cell.h +++ b/apps/graph/function_title_cell.h @@ -10,7 +10,7 @@ public: HorizontalIndicator, VerticalIndicator }; - FunctionTitleCell(Orientation orientation, KDText::FontSize size); + FunctionTitleCell(Orientation orientation, KDText::FontSize size = KDText::FontSize::Small); void setColor(KDColor color); void setText(const char * textContent); void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index e03f2e0f7..3ca116806 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -7,8 +7,8 @@ namespace Graph { ListController::ListController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header) : ViewController(parentResponder), HeaderViewDelegate(header), - m_functionTitleCells{FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator, KDText::FontSize::Large), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator, KDText::FontSize::Large), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator, KDText::FontSize::Large), - FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator, KDText::FontSize::Large), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator, KDText::FontSize::Large), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator, KDText::FontSize::Large)}, + m_functionTitleCells{FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), + FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator)}, m_selectableTableView(SelectableTableView(this, this, 0, 0, 0, 0, nullptr, false, true)), m_functionStore(functionStore), m_parameterController(ParameterController(this, functionStore)) @@ -48,7 +48,7 @@ KDCoordinate ListController::rowHeight(int j) { return k_emptyRowHeight; } KDCoordinate functionSize = function->layout()->size().height(); - return functionSize + k_emptyRowHeight - KDText::stringSize(" ", KDText::FontSize::Large).height(); + return functionSize + k_emptyRowHeight - KDText::stringSize(" ").height(); } KDCoordinate ListController::columnWidth(int i) { diff --git a/apps/probability/calculation_controller.cpp b/apps/probability/calculation_controller.cpp index 20526d06a..9d3f514c2 100644 --- a/apps/probability/calculation_controller.cpp +++ b/apps/probability/calculation_controller.cpp @@ -11,10 +11,9 @@ namespace Probability { CalculationController::ContentView::ContentView(Responder * parentResponder, CalculationController * calculationController, Calculation * calculation) : m_lawCurveView(LawCurveView()), m_imageTableView(ImageTableView(parentResponder, calculation, calculationController)), - m_text{PointerTextView(KDText::FontSize::Large), PointerTextView(KDText::FontSize::Large), PointerTextView(KDText::FontSize::Large)}, - m_calculationCell{EditableTextCell(parentResponder, calculationController, m_draftTextBuffer, KDText::FontSize::Large), - EditableTextCell(parentResponder, calculationController, m_draftTextBuffer, KDText::FontSize::Large), - EditableTextCell(parentResponder, calculationController, m_draftTextBuffer, KDText::FontSize::Large)}, + m_calculationCell{EditableTextCell(parentResponder, calculationController, m_draftTextBuffer), + EditableTextCell(parentResponder, calculationController, m_draftTextBuffer), + EditableTextCell(parentResponder, calculationController, m_draftTextBuffer)}, m_calculation(calculation) { } @@ -70,7 +69,7 @@ void CalculationController::ContentView::willDisplayEditableCellAtIndex(int inde void CalculationController::ContentView::layoutSubviews() { markRectAsDirty(bounds()); - KDSize charSize = KDText::stringSize(" ", KDText::FontSize::Large); + KDSize charSize = KDText::stringSize(" "); KDCoordinate xCoordinate = 0; m_lawCurveView.setFrame(KDRect(0, ImageTableView::k_imageHeight, bounds().width(), bounds().height() - ImageTableView::k_imageHeight)); m_imageTableView.setFrame(KDRect(xCoordinate, 0, ImageTableView::k_imageWidth, 3*ImageTableView::k_imageHeight)); diff --git a/apps/statistics/histogram_controller.cpp b/apps/statistics/histogram_controller.cpp index bfa9ac0cb..d1b2c6dc2 100644 --- a/apps/statistics/histogram_controller.cpp +++ b/apps/statistics/histogram_controller.cpp @@ -14,7 +14,7 @@ HistogramController::HistogramController(Responder * parentResponder, HeaderView HistogramController * histogramController = (HistogramController *) context; StackViewController * stack = ((StackViewController *)histogramController->stackController()); stack->push(histogramController->histogramParameterController()); - }, this), KDText::FontSize::Small)), + }, this))), m_store(store), m_cursor(CurveViewCursor()), m_histogramParameterController(nullptr, store) diff --git a/apps/store_controller.cpp b/apps/store_controller.cpp index 336b73e22..aca559175 100644 --- a/apps/store_controller.cpp +++ b/apps/store_controller.cpp @@ -6,11 +6,11 @@ StoreController::StoreController(Responder * parentResponder, FloatPairStore * store, HeaderViewController * header) : EditableCellTableViewController(parentResponder, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin), HeaderViewDelegate(header), - m_editableCells{EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), - EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), - EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), - EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), - EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer, KDText::FontSize::Large)}, + m_editableCells{EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), + EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), + EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), + EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), + EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer)}, m_store(store), m_storeParameterController(this, store) { diff --git a/escher/include/escher/buffer_text_view.h b/escher/include/escher/buffer_text_view.h index aaee0bb7e..c7b4329da 100644 --- a/escher/include/escher/buffer_text_view.h +++ b/escher/include/escher/buffer_text_view.h @@ -5,7 +5,7 @@ class BufferTextView : public TextView { public: - BufferTextView(KDText::FontSize size, float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f, + BufferTextView(KDText::FontSize size = KDText::FontSize::Large, float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); void setText(const char * text) override; const char * text() const override; diff --git a/escher/include/escher/button.h b/escher/include/escher/button.h index 8caa6864d..1afc9d7b5 100644 --- a/escher/include/escher/button.h +++ b/escher/include/escher/button.h @@ -8,7 +8,7 @@ class Button : public View, public Responder { public: - Button(Responder * parentResponder, const char * textBody, Invocation invocation, KDText::FontSize size); + Button(Responder * parentResponder, const char * textBody, Invocation invocation, KDText::FontSize size = KDText::FontSize::Small); void drawRect(KDContext * ctx, KDRect rect) const override; bool handleEvent(Ion::Events::Event event) override; void setBackgroundColor(KDColor backgroundColor); diff --git a/escher/include/escher/editable_text_cell.h b/escher/include/escher/editable_text_cell.h index 31b0e9e39..b91b918cf 100644 --- a/escher/include/escher/editable_text_cell.h +++ b/escher/include/escher/editable_text_cell.h @@ -8,7 +8,7 @@ class EditableTextCell : public TableViewCell, public Responder { public: - EditableTextCell(Responder * parentResponder, TextFieldDelegate * delegate, char * draftTextBuffer, KDText::FontSize size, + EditableTextCell(Responder * parentResponder, TextFieldDelegate * delegate, char * draftTextBuffer, KDText::FontSize size = KDText::FontSize::Large, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite); TextField * textField(); void reloadCell() override; diff --git a/escher/include/escher/even_odd_editable_text_cell.h b/escher/include/escher/even_odd_editable_text_cell.h index b250307af..42b658f67 100644 --- a/escher/include/escher/even_odd_editable_text_cell.h +++ b/escher/include/escher/even_odd_editable_text_cell.h @@ -7,7 +7,7 @@ class EvenOddEditableTextCell : public EvenOddCell, public Responder { public: - EvenOddEditableTextCell(Responder * parentResponder, TextFieldDelegate * delegate, char * draftTextBuffer, KDText::FontSize size); + EvenOddEditableTextCell(Responder * parentResponder, TextFieldDelegate * delegate, char * draftTextBuffer, KDText::FontSize size = KDText::FontSize::Large); EditableTextCell * editableTextCell(); void reloadCell() override; const char * text() const; diff --git a/escher/include/escher/even_odd_pointer_text_cell.h b/escher/include/escher/even_odd_pointer_text_cell.h index 58f2e1bc0..493caab85 100644 --- a/escher/include/escher/even_odd_pointer_text_cell.h +++ b/escher/include/escher/even_odd_pointer_text_cell.h @@ -6,7 +6,7 @@ class EvenOddPointerTextCell : public EvenOddCell { public: - EvenOddPointerTextCell(KDText::FontSize size); + EvenOddPointerTextCell(KDText::FontSize size = KDText::FontSize::Large); void reloadCell() override; void setText(const char * textContent, KDColor textColor = KDColorBlack); void setAlignment(float horizontalAlignment, float verticalAlignment); diff --git a/escher/include/escher/pointer_text_view.h b/escher/include/escher/pointer_text_view.h index d60a0dff2..0f2f2cf7f 100644 --- a/escher/include/escher/pointer_text_view.h +++ b/escher/include/escher/pointer_text_view.h @@ -5,7 +5,7 @@ class PointerTextView : public TextView { public: - PointerTextView(KDText::FontSize size, const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, + PointerTextView(KDText::FontSize size = KDText::FontSize::Large, const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); void setText(const char * text) override; protected: diff --git a/escher/include/escher/text_field.h b/escher/include/escher/text_field.h index 54d166d1d..3db49e08c 100644 --- a/escher/include/escher/text_field.h +++ b/escher/include/escher/text_field.h @@ -9,7 +9,7 @@ class TextField : public View, public Responder { public: TextField(Responder * parentResponder, char * textBuffer, char * draftTextBuffer, size_t textBufferSize, - KDText::FontSize size, TextFieldDelegate * delegate = nullptr, float horizontalAlignment = 0.0f, + TextFieldDelegate * delegate = nullptr, KDText::FontSize size = KDText::FontSize::Large, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite); // View void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/escher/include/escher/text_view.h b/escher/include/escher/text_view.h index 150f88384..427d26601 100644 --- a/escher/include/escher/text_view.h +++ b/escher/include/escher/text_view.h @@ -9,7 +9,7 @@ public: // alignment = 0 -> align left or top // alignment = 0.5 -> align center // alignment = 1.0 -> align right or bottom - TextView(KDText::FontSize size, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, + TextView(KDText::FontSize size = KDText::FontSize::Large, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); void drawRect(KDContext * ctx, KDRect rect) const override; void setBackgroundColor(KDColor backgroundColor); diff --git a/escher/src/editable_text_cell.cpp b/escher/src/editable_text_cell.cpp index b7f64d1c1..f9c2d4927 100644 --- a/escher/src/editable_text_cell.cpp +++ b/escher/src/editable_text_cell.cpp @@ -7,7 +7,7 @@ EditableTextCell::EditableTextCell(Responder * parentResponder, TextFieldDelegat KDText::FontSize size, float horizontalAlignment, float verticalAlignment, KDColor textColor, KDColor backgroundColor) : TableViewCell(), Responder(parentResponder), - m_textField(TextField(this, m_textBody, draftTextBuffer, 255, size, delegate, horizontalAlignment, verticalAlignment, textColor, backgroundColor)) + m_textField(TextField(this, m_textBody, draftTextBuffer, 255, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor)) { } diff --git a/escher/src/editable_text_menu_list_cell.cpp b/escher/src/editable_text_menu_list_cell.cpp index 5a1b9e8a8..f8504be2d 100644 --- a/escher/src/editable_text_menu_list_cell.cpp +++ b/escher/src/editable_text_menu_list_cell.cpp @@ -4,7 +4,7 @@ EditableTextMenuListCell::EditableTextMenuListCell(Responder * parentResponder, TextFieldDelegate * textFieldDelegate, char * draftTextBuffer, char * label) : Responder(parentResponder), MenuListCell(label), - m_textField(TextField(this, m_textBody, draftTextBuffer, 255, KDText::FontSize::Large, textFieldDelegate, 1.0f, 0.5f)) + m_textField(TextField(this, m_textBody, draftTextBuffer, 255, textFieldDelegate, KDText::FontSize::Large, 1.0f, 0.5f)) { } @@ -20,7 +20,7 @@ void EditableTextMenuListCell::layoutSubviews() { MenuListCell::layoutSubviews(); KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); - KDSize charSize = KDText::stringSize(" ", KDText::FontSize::Large); + KDSize charSize = KDText::stringSize(" "); KDCoordinate textWidth = k_maxNumberOfEditableCharacters*charSize.width(); m_textField.setFrame(KDRect(width - textWidth - k_separatorThickness, (height - charSize.height())/2, textWidth - k_separatorThickness, charSize.height())); } diff --git a/escher/src/input_view_controller.cpp b/escher/src/input_view_controller.cpp index d96f2c573..efe57a296 100644 --- a/escher/src/input_view_controller.cpp +++ b/escher/src/input_view_controller.cpp @@ -4,7 +4,7 @@ InputViewController::TextFieldController::TextFieldController(Responder * parentResponder, TextFieldDelegate * textFieldDelegate) : ViewController(parentResponder), - m_textField(parentResponder, m_textBody, m_textBody, 255, KDText::FontSize::Large, textFieldDelegate) + m_textField(parentResponder, m_textBody, m_textBody, 255, textFieldDelegate) { m_textBody[0] = 0; } diff --git a/escher/src/tab_view_cell.cpp b/escher/src/tab_view_cell.cpp index 7821d4c26..01365e99f 100644 --- a/escher/src/tab_view_cell.cpp +++ b/escher/src/tab_view_cell.cpp @@ -48,7 +48,7 @@ void TabViewCell::drawRect(KDContext * ctx, KDRect rect) const { // Write title KDSize textSize = KDText::stringSize(m_name, KDText::FontSize::Small); KDPoint origin(0.5f*(m_frame.width() - textSize.width()),0.5f*(m_frame.height() - textSize.height())); - ctx->drawString(m_name, KDText::FontSize::Small, origin, text, background); + ctx->drawString(m_name, origin, KDText::FontSize::Small, text, background); } #if ESCHER_VIEW_LOGGING diff --git a/escher/src/text_field.cpp b/escher/src/text_field.cpp index b0f44f165..c87193e7d 100644 --- a/escher/src/text_field.cpp +++ b/escher/src/text_field.cpp @@ -2,7 +2,7 @@ #include TextField::TextField(Responder * parentResponder, char * textBuffer, char * draftTextBuffer, - size_t textBufferSize, KDText::FontSize size, TextFieldDelegate * delegate, + size_t textBufferSize, TextFieldDelegate * delegate, KDText::FontSize size, float horizontalAlignment, float verticalAlignment, KDColor textColor, KDColor backgroundColor) : View(), Responder(parentResponder), @@ -33,7 +33,7 @@ void TextField::drawRect(KDContext * ctx, KDRect rect) const { KDSize textSize = KDText::stringSize(text(), m_fontSize); KDPoint origin(m_horizontalAlignment*(m_frame.width() - textSize.width()), m_verticalAlignment*(m_frame.height() - textSize.height())); - ctx->drawString(text(), m_fontSize, origin, m_textColor, m_backgroundColor); + ctx->drawString(text(), origin, m_fontSize, m_textColor, m_backgroundColor); } #if ESCHER_VIEW_LOGGING diff --git a/escher/src/text_view.cpp b/escher/src/text_view.cpp index 6b80fa8e9..bf3daace5 100644 --- a/escher/src/text_view.cpp +++ b/escher/src/text_view.cpp @@ -39,7 +39,7 @@ void TextView::drawRect(KDContext * ctx, KDRect rect) const { KDPoint origin(m_horizontalAlignment*(m_frame.width() - textSize.width()), m_verticalAlignment*(m_frame.height() - textSize.height())); ctx->fillRect(bounds(), m_backgroundColor); - ctx->drawString(text(), m_fontSize, origin, m_textColor, m_backgroundColor); + ctx->drawString(text(), origin, m_fontSize, m_textColor, m_backgroundColor); } #if ESCHER_VIEW_LOGGING diff --git a/kandinsky/include/kandinsky/context.h b/kandinsky/include/kandinsky/context.h index 874ebc335..9113644b0 100644 --- a/kandinsky/include/kandinsky/context.h +++ b/kandinsky/include/kandinsky/context.h @@ -15,10 +15,10 @@ public: KDColor getPixel(KDPoint p); // Text - void drawChar(char character, KDText::FontSize size, KDPoint p, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); - void drawString(const char * text, KDText::FontSize size, KDPoint p, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); - void blendChar(char character, KDText::FontSize size, KDPoint p, KDColor textColor = KDColorBlack); - void blendString(const char * text, KDText::FontSize size, KDPoint p, KDColor textColor = KDColorBlack); + void drawChar(char character, KDPoint p, KDText::FontSize size = KDText::FontSize::Large, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); + void drawString(const char * text, KDPoint p, KDText::FontSize size = KDText::FontSize::Large, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); + void blendChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor = KDColorBlack); + void blendString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor = KDColorBlack); // Line. Not anti-aliased. void drawLine(KDPoint p1, KDPoint p2, KDColor c); diff --git a/kandinsky/include/kandinsky/text.h b/kandinsky/include/kandinsky/text.h index 230ddc0d7..fb18f1d78 100644 --- a/kandinsky/include/kandinsky/text.h +++ b/kandinsky/include/kandinsky/text.h @@ -9,7 +9,7 @@ public: Small, Large }; - static KDSize stringSize(const char * text, FontSize size); + static KDSize stringSize(const char * text, FontSize size = FontSize::Large); }; #endif diff --git a/kandinsky/src/context_text.cpp b/kandinsky/src/context_text.cpp index 4dc237dba..23370cc5a 100644 --- a/kandinsky/src/context_text.cpp +++ b/kandinsky/src/context_text.cpp @@ -5,7 +5,7 @@ KDColor smallCharacterBuffer[BITMAP_SmallFont_CHARACTER_WIDTH*BITMAP_SmallFont_CHARACTER_HEIGHT]; KDColor largeCharacterBuffer[BITMAP_LargeFont_CHARACTER_WIDTH*BITMAP_LargeFont_CHARACTER_HEIGHT]; -void KDContext::drawChar(char character, KDText::FontSize size, KDPoint p, KDColor textColor, KDColor backgroundColor) { +void KDContext::drawChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor) { char firstCharacter = size == KDText::FontSize::Large ? BITMAP_LargeFont_FIRST_ASCII_CHARACTER : BITMAP_SmallFont_FIRST_ASCII_CHARACTER; int characterHeight = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_HEIGHT : BITMAP_SmallFont_CHARACTER_HEIGHT; int characterWidth = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_WIDTH : BITMAP_SmallFont_CHARACTER_WIDTH; @@ -27,18 +27,18 @@ void KDContext::drawChar(char character, KDText::FontSize size, KDPoint p, KDCol characterBuffer); } -void KDContext::drawString(const char * text, KDText::FontSize size, KDPoint p, KDColor textColor, KDColor backgroundColor) { +void KDContext::drawString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor) { KDPoint position = p; int characterWidth = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_WIDTH : BITMAP_SmallFont_CHARACTER_WIDTH; KDPoint characterSize(characterWidth, 0); while(*text != 0) { - drawChar(*text, size, position, textColor, backgroundColor); + drawChar(*text, position, size, textColor, backgroundColor); text++; position = position.translatedBy(characterSize); } } -void KDContext::blendChar(char character, KDText::FontSize size, KDPoint p, KDColor textColor) { +void KDContext::blendChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor) { int firstCharacter = size == KDText::FontSize::Large ? BITMAP_LargeFont_FIRST_ASCII_CHARACTER : BITMAP_SmallFont_FIRST_ASCII_CHARACTER; int characterHeight = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_HEIGHT : BITMAP_SmallFont_CHARACTER_HEIGHT; int characterWidth = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_WIDTH : BITMAP_SmallFont_CHARACTER_WIDTH; @@ -65,12 +65,12 @@ void KDContext::blendChar(char character, KDText::FontSize size, KDPoint p, KDCo pushRect(absoluteRect, characterBuffer); } -void KDContext::blendString(const char * text, KDText::FontSize size, KDPoint p, KDColor textColor) { +void KDContext::blendString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor) { KDPoint position = p; int characterWidth = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_WIDTH : BITMAP_SmallFont_CHARACTER_WIDTH; KDPoint characterSize(characterWidth, 0); while(*text != 0) { - blendChar(*text, size, position, textColor); + blendChar(*text, position, size, textColor); text++; position = position.translatedBy(characterSize); } diff --git a/poincare/src/layout/fraction_layout.cpp b/poincare/src/layout/fraction_layout.cpp index 900f59346..ca964d40c 100644 --- a/poincare/src/layout/fraction_layout.cpp +++ b/poincare/src/layout/fraction_layout.cpp @@ -8,7 +8,7 @@ ExpressionLayout(), m_numerator_layout(numerator_layout), m_denominator_layout(d m_denominator_layout->setParent(this); m_baseline = m_numerator_layout->size().height() + k_fractionLineMargin - + KDText::stringSize(" ", KDText::FontSize::Large).height()/2; + + KDText::stringSize(" ").height()/2; } FractionLayout::~FractionLayout() { diff --git a/poincare/src/layout/matrix_layout.cpp b/poincare/src/layout/matrix_layout.cpp index 23c9a3b21..72a6de3d3 100644 --- a/poincare/src/layout/matrix_layout.cpp +++ b/poincare/src/layout/matrix_layout.cpp @@ -13,7 +13,7 @@ MatrixLayout::MatrixLayout(ExpressionLayout ** entryLayouts, int numberOfRows, i for (int i = 0; i < m_numberOfRows*m_numberOfColumns; i++) { m_entryLayouts[i]->setParent(this); } - m_baseline = height()/2 + KDText::stringSize(" ", KDText::FontSize::Large).height()/2; + m_baseline = height()/2 + KDText::stringSize(" ").height()/2; } MatrixLayout::~MatrixLayout() { diff --git a/poincare/src/layout/string_layout.cpp b/poincare/src/layout/string_layout.cpp index fdc3d376c..df19bacf5 100644 --- a/poincare/src/layout/string_layout.cpp +++ b/poincare/src/layout/string_layout.cpp @@ -22,7 +22,7 @@ ExpressionLayout * StringLayout::child(uint16_t index) { } void StringLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) { - ctx->drawString(m_string, m_fontSize, p, expressionColor, backgroundColor); + ctx->drawString(m_string, p, m_fontSize, expressionColor, backgroundColor); } KDPoint StringLayout::positionOfChild(ExpressionLayout * child) { diff --git a/quiz/src/runner.cpp b/quiz/src/runner.cpp index da0c0fce5..fd6cfca17 100644 --- a/quiz/src/runner.cpp +++ b/quiz/src/runner.cpp @@ -6,8 +6,8 @@ void print(const char * message) { static int line_y = 0; KDContext * ctx = KDIonContext::sharedContext(); - int line_height = KDText::stringSize("M", KDText::FontSize::Large).height(); - ctx->drawString(message, KDText::FontSize::Large, KDPoint(0, line_y), KDColorBlack); + int line_height = KDText::stringSize("M").height(); + ctx->drawString(message, KDPoint(0, line_y)); line_y += line_height; if (line_y > Ion::Display::Height) { line_y = 0;