简体   繁体   English

Graphics.DrawString-不起作用的fontfamily文本格式

[英]Graphics.DrawString - not work fontfamily text format

Overlay text on video: 在视频上叠加文字:

using (f_graphics = Graphics.FromImage(f_bmp_overlay))
            {
                f_graphics.Clear(System.Drawing.Color.Transparent);
                f_graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                f_graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                f_graphics.DrawString(f_text, f_font, f_color, new PointF(15, 15));
            }

Text color and size work good, but FontFamily apply only numbers. 文本颜色和大小可以很好地工作,但是FontFamily仅应用数字。

在此处输入图片说明

What can be done? 该怎么办?

You are using cyrillic characters, which the physical font obviously does not contain. 您正在使用西里尔字符,而该物理字体显然不包含此字符。 So the system substitutes glyphs from another font it chooses. 因此,系统会从它选择的另一种字体中替换字形。 Try with latin characters and you will see that they too are properly printed. 尝试使用拉丁字符,您会发现它们也已正确打印。

You need a font file that contains glyphs for all Unicode code points you are printing, and use that instead. 您需要一个字体文件,其中包含要打印的所有Unicode代码点的字形,而应使用该字形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM