Skip to content

ass::FontSize#

Controls the font size of AView.

Header:#include <AUI/ASS/Property/FontSize.h>
CMake:aui_link(my_target PUBLIC aui::views)

Examples#

examples/app/fractal/src/FractalWindow.cpp

Fractal Example — Fractal viewer application demonstrating usage of custom shaders.

        centerPosDisplay->setCustomStyle({
          BackgroundSolid { 0x80000000_argb },
          Padding { 4_dp },
          TextColor { 0xffffff_rgb },
          FontSize { 11_pt },
        });
    }

    auto fractal = _new<FractalView>();
    connect(fractal->centerPosChanged, this, [centerPosDisplay](const glm::dvec2& newPos, double scale) {
examples/app/notes/src/main.cpp

Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.

    return Vertical {
        Label {
          .text = AUI_REACT(stringOneLinePreview(note->title)),
        } AUI_OVERRIDE_STYLE { FontSize { 10_pt }, ATextOverflow::ELLIPSIS },
        Label {
          .text = AUI_REACT(stringOneLinePreview(note->content)),
        } AUI_OVERRIDE_STYLE {
              ATextOverflow::ELLIPSIS,
              Opacity { 0.7f },
examples/ui/contacts/src/main.cpp

AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

                                .content = AUI_REACT(mSearchQuery->empty() ? indexedList() : searchQueryList()),
                            },
                            Label { AUI_REACT("{} contact(s)"_format(mContactCount)) } AUI_LET {
                                AObject::connect(AUI_REACT(ass::PropertyList{
                                    FontSize { 10_pt },
                                    ATextAlign::CENTER,
                                    Margin { 8_dp },
                                    mSearchQuery->empty() ? Visibility::VISIBLE : Visibility::GONE,
                                }), AUI_SLOT(it)::setCustomStyle);
                            },
examples/ui/views/src/ExampleWindow.cpp

Views Example — All-in-one views building example.

                  _<AViewContainer> v2 = Vertical {};
                  for (int i = 0; i <= 9; ++i) {
                      v1->addView(Horizontal {
                        _new<ALabel>("{} px"_format(i + 6)),
                        _new<ALabel>("Hello! [] .~123`") AUI_OVERRIDE_STYLE { FontSize { AMetric(i + 6, AMetric::T_PX) } } });
                      v2->addView(Horizontal {
                        _new<ALabel>("{} px"_format(i + 16)),
                        _new<ALabel>("Hello! [].~123`") AUI_OVERRIDE_STYLE { FontSize { AMetric(i + 16, AMetric::T_PX) } } });
                  }
                  return Horizontal { v1, v2 };
examples/ui/contacts/src/view/ContactDetailsView.cpp

AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

_<AView> profilePhoto(const _<Contact>& contact) {
    return Centered {
        Label {
          AUI_REACT(contact->displayName->empty() ? "?" : AString(1, contact->displayName->first()).uppercase())
        } AUI_OVERRIDE_STYLE { Opacity(0.5f), FontSize { 32_dp } },
    } AUI_OVERRIDE_STYLE {
        FixedSize { 64_dp },
        BorderRadius { 32_dp },
        BackgroundGradient { AColor::GRAY.lighter(0.5f), AColor::GRAY, 163_deg },
    };