Skip to content

Commit

Permalink
fix for trying to retrieve font from spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-virkus committed Sep 28, 2021
1 parent 9d28929 commit efb9195
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/src/unicode_font_converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit efb9195

Please sign in to comment.