From efb9195a5f6ff409462173ebd5f13c2f89efddd9 Mon Sep 17 00:00:00 2001 From: Robert Virkus Date: Tue, 28 Sep 2021 16:07:33 +0200 Subject: [PATCH] fix for trying to retrieve font from spaces --- lib/src/unicode_font_converter.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/unicode_font_converter.dart b/lib/src/unicode_font_converter.dart index f1bc986..e87c269 100644 --- a/lib/src/unicode_font_converter.dart +++ b/lib/src/unicode_font_converter.dart @@ -197,11 +197,12 @@ class UnicodeFontConverter { /// Tries to determine the font from the first or last character of the given [text]. /// /// Set [fromStart] to `true` to check the font from the start. - static UnicodeFont getFont(final String text, {bool fromStart = false}) { + static UnicodeFont getFont(String text, {bool fromStart = false}) { + text = text.trim(); if (text.isEmpty) { return UnicodeFont.normal; } - final characters = Characters(text.trim()); + final characters = Characters(text); final character = fromStart ? characters.first : characters.last; for (final font in _fonts.entries) { if (font.value.contains(character)) {