Skip to content

Text wrapping issue with specific font settings #30347

@maxlapides

Description

@maxlapides

I'm running into an issue where some text strings are wrapping unexpectedly. This only occurs with specific fonts and specific style settings on Text, but it's reliably reproducible.

Here's a screenshot of the issue:

Simulator Screen Shot - iPhone Xs - 2019-04-01 at 16 42 32

Here's a reproduction case, in full:

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text Wrapping Issue',
      home: Scaffold(
        body: Container(
          alignment: Alignment.center,
          child: Text(
            '24/16',
            style: TextStyle(
              fontFamily: 'League Gothic',
              fontSize: 30,
              letterSpacing: 0.7,
            ),
          ),
        ),
      ),
    );
  }
}

Because this reproduction case uses the font League Gothic, I made a repo to make it easier to reproduce: https://github.com/maxlapides/flutter-text-wrapping-issue

When testing it out, you'll notice that changing the Text.data value from 24/16 to most other things, or changing the fontSize, or changing the letterSpacing will resolve the issue. Strangely, it only happens with particular combinations of these settings.

❯ flutter doctor -v
[✓] Flutter (Channel beta, v1.3.8, on Mac OS X 10.14.3 18D109, locale en-US)
    • Flutter version 1.3.8 at /Users/maxlapides/flutter
    • Framework revision e5b1ed7a7f (4 weeks ago), 2019-03-06 14:23:37 -0800
    • Engine revision f4951df193
    • Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/maxlapides/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/maxlapides/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2, Build version 10E125
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code (version 1.32.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.25.0

[✓] Connected device (2 available)
    • SAMSUNG SM G920A • 03157df3c5558209                     • android-arm64 • Android 5.1.1 (API 22)
    • iPhone Xs        • 4B3A0C53-93BF-4FB6-B989-9154DCCE61B8 • ios           • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: typographyText rendering, possibly libtxtframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions