Skip to content

use skiasharp font instead of SixLabor fonts #456

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Nov 1, 2022

Conversation

linch90
Copy link
Contributor

@linch90 linch90 commented Oct 31, 2022

  1. As the sixlabors.Fonts has performance issue when it measure text.
    image
    From the benchmark, you can see the the SixLabors is almost 9th or 10th slower than the System.Drawing Graphics, 45th slower than the SkiaSharp.
    The SixLabors will slower down the export speed when you use autofitcolumns
    The SixLabors.Font is still in beta phase.

So, use the skiasharp to measure text.

  1. add FangSong default font for measuring chinese or other texts(not in english), as no matter SixLabors, or SkiaSharp, all give unconsistent result compare with the System.Drawing when use the Calibri font.
    image

  1. SixLabors.Fonts的MeasureText存在性能问题
    通过Benchmark, SixLabor要比System.Drawing Graphics慢9到10倍,比SkiaSharp慢45倍左右
    导致输出Excel文件时,定义了AutoFit时,会极大的减慢Excel导出速度。
    目前SixLabors.Fonts仍然在Beta阶段。
    此次,改为SkiaSharp来进行MeasureText操作
  2. 增加了FangSong(仿宋)来对中文或其他非英文文本进行MeasureText操作,因为无论SixLabors, 还是SkiaSharp, 在通过Calibri字体计算文本长时,与System.Drawing相比都会输出错误的长度。

@xl-wenqiang xl-wenqiang self-assigned this Nov 1, 2022
@xl-wenqiang xl-wenqiang added this to the 2.7.0 milestone Nov 1, 2022
@xl-wenqiang xl-wenqiang merged commit 6d3b786 into dotnetcore:develop Nov 1, 2022
@xl-wenqiang
Copy link
Collaborator

@linch90
感谢您的贡献,不过Magicodes.IE.Excel已经移除了对Magicodes.IE.Excel.NPOI的引用,Magicodes.IE.Excel.NPOI仅作为扩展存在。麻烦您拉取最新的develop分支代码后进行pr。也可以由我这边找时间来逐个文件合并。

@linch90
Copy link
Contributor Author

linch90 commented Nov 2, 2022

@xl-wenqiang 好的,我这里处理下

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants