# windows: Fix incorrect font rendering \(\#11545\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5103995c32f01469c4b1c317f415877e0b360cb4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5103995c32f01469c4b1c317f415877e0b360cb4

Requested commit: 5103995c32f01469c4b1c317f415877e0b360cb4

Commit: 5103995c32f01469c4b1c317f415877e0b360cb4

Tree: 659daebf42f083f33f951aa8993fa0c2e6420c75

Author: 张小白

Committer: GitHub

## Message

```
windows: Fix incorrect font rendering (#11545)

Previously, `DirectWrite` had been following the text system
implementation on `macOS`, using the font's postscript name to
differentiate between different font faces. However, I noticed
occasional rendering issues, such as fonts incorrectly rendering as
italics. Later, I discovered that on `Windows`, the postscript name is
**not** unique. Surprisingly, even the same font can have different
postscript names on macOS and Windows! It's hard to believe! The
postscript name of a font face should be obtained from the same font
table. Why would the same font face have different names?

For example, the postscript name of ZedMono on `macOS` is
`Zed-Mono-Bold-Extended-Italic`, while on `Windows`, it is
`Zed-Mono-Extended`, missing weight and style information, leading to
incorrect rendering.

This PR introduces a `FontIdentifier` struct to uniquely identify font
faces.

Release Notes:

- N/A
```

## Parents

- [fb4c6dbaa79eaea49ec043ef355a61fc4467401f](https://git.cafe/gitcafe/zed/commit/fb4c6dbaa79eaea49ec043ef355a61fc4467401f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5103995c32f01469c4b1c317f415877e0b360cb4?format=markdown)
