From 27e83b6008659c1641b5f78cde4b203fe84bdcc2 Mon Sep 17 00:00:00 2001 From: Dav999 Date: Wed, 3 Jan 2024 20:23:57 +0100 Subject: [PATCH] Add font::is_rtl(uint32_t flags) This will return if the given flags indicate RTL properties (such as textboxes being right-aligned). --- desktop_version/src/Font.cpp | 6 ++++++ desktop_version/src/Font.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Font.cpp b/desktop_version/src/Font.cpp index abffcb6a..3396d3aa 100644 --- a/desktop_version/src/Font.cpp +++ b/desktop_version/src/Font.cpp @@ -1247,6 +1247,12 @@ int height(const uint32_t flags) return pf.font_sel->glyph_h * pf.scale; } +bool is_rtl(const uint32_t flags) +{ + PrintFlags pf = decode_print_flags(flags); + return pf.rtl; +} + void print( const uint32_t flags, int x, diff --git a/desktop_version/src/Font.h b/desktop_version/src/Font.h index 8b6c86d6..662f882e 100644 --- a/desktop_version/src/Font.h +++ b/desktop_version/src/Font.h @@ -85,7 +85,8 @@ std::string string_unwordwrap(const std::string& s); bool glyph_dimensions(uint32_t flags, uint8_t* glyph_w, uint8_t* glyph_h); int len(uint32_t flags, const char* text); -int height(const uint32_t flags); +int height(uint32_t flags); +bool is_rtl(uint32_t flags); void print( uint32_t flags,