Repository: flutter
Issue: Bold Chinese character rotation rendering bug
Labels: engine,a: internationalization,dependency: skia,a: typography,c: rendering,has reproducible steps,P2,team-engine,triaged-engine,found in release: 3.13,found in release: 3.16

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

I encountered a bug when I tried to customize a circle of text using CustomPaint. So when I tried to change the font size, the bold font randomly rendered into serif mode。
1. use font "幼圆"[http://guojiang.jiexinit.cn/7166f62c8d654df58002ac42b861e41c.TTF]
2. set fontWeight to bold
3. draw text and try to rotate canvas
4. change fontSize may reproduce
5. my sample code can reproduce

### Expected results

The bold font should be rendered correctly, although I know that the fake bold font could be achieved by drawing the serif of the font as well.
 I want to know this bug is caused by font or flutter engine

### Actual results

<img width="796" alt="截屏2023-10-27 15 23 18" src="https://github.com/flutter/flutter/assets/17976216/1205f348-bafc-4566-a7bf-bafe15df64bc">


### Code sample

<details><summary>Code sample</summary>

```dart
import 'dart:math';

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double fontSize = 24.0;
  String content = "呼呼呼呼呼呼呼呼呼呼";
  late TextStyle textStyle;

  @override
  Widget build(BuildContext context) {
    textStyle = TextStyle(
        fontSize: fontSize,
        fontWeight: FontWeight.bold,
        fontFamily: "FontYY",
        color: Colors.black);
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          children: [
            Expanded(
                child: Center(
                    child: CustomPaint(
              painter: RoundTextPainter(content, textStyle),
            ))),
            Text("textSize: $fontSize"),
            Slider(
                value: fontSize,
                max: 100,
                min: 5,
                onChanged: (v) {
                  setState(() {
                    fontSize = v;
                  });
                })
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

class RoundTextPainter extends CustomPainter {
  final String text;
  final TextStyle textStyle;
  final TextPainter _textPainter =
      TextPainter(textDirection: TextDirection.ltr, textScaleFactor: 1.0);
  double fontHeight = 0;
  double radius = 0;

  RoundTextPainter(this.text, this.textStyle);

  @override
  void paint(Canvas canvas, Size size) {
    double arcLength = 0;
    canvas.translate(size.width / 2, size.height / 2);
    for (var char in text.characters) {
      _textPainter.text = TextSpan(text: char, style: textStyle);
      _textPainter.layout(maxWidth: double.maxFinite);
      arcLength += _textPainter.width;
    }
    fontHeight = _textPainter.height;
    radius = arcLength / (2 * pi);
    double prevAngle = 0;
    for (var char in text.characters) {
      prevAngle = _drawLetter(canvas, char, prevAngle);
    }
  }

  double _drawLetter(Canvas canvas, String letter, double prevAngle) {
    _textPainter.text = TextSpan(text: letter, style: textStyle);
    _textPainter.layout(
      minWidth: 0,
      maxWidth: double.maxFinite,
    );
    final double d = _textPainter.width;

    final double alpha;
    alpha = 2 * asin(d / (2 * 1 * radius));

    final newAngle = (prevAngle + alpha) / 2;
    canvas.rotate(newAngle);
    _textPainter.paint(canvas, Offset(0, -fontHeight));
    canvas.translate(d, 0);
    return alpha;
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return true;
  }
}

```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

<img width="796" alt="截屏2023-10-27 15 23 18" src="https://github.com/flutter/flutter/assets/17976216/1205f348-bafc-4566-a7bf-bafe15df64bc">


</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.7.12, on macOS 14.0 23A344 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.7.12 on channel stable at /Users/opos_teck/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (6 months ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/opos_teck/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (3 available)
    • 此iphone设备无法连接 (mobile) • 00008020-00055C221EC2002E • ios            • iOS 16.6 20G75
    • macOS (desktop)        • macos                     • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)           • chrome                    • web-javascript • Google Chrome 118.0.5993.117

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
Process finished with exit code 0
```

</details>