为什么两个字符一样宽,放到一起却不是二倍宽度

谁学逆向工程 2016-09-04 03:21:30
两个字符一样宽就不合理,为什么放到一起还不是二倍宽度
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Drawing.Printing;

class HelloPrinter : Form
{
public static void Main()
{
Application.Run(new HelloPrinter());
}
public HelloPrinter()
{
Text = "Hello Printer!";
BackColor = SystemColors.Window;
ForeColor = SystemColors.WindowText;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics grfx = e.Graphics;
string i = "i";
string w = "W";
string iw = "iw";
SizeF iSize = grfx.MeasureString(i, Font);
SizeF wSize = grfx.MeasureString(w, Font);
SizeF iwSize = grfx.MeasureString(iw, Font);
}
}

...全文
272 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuzuning 2016-09-04
  • 打赏
  • 举报
回复
AWA VAV HHH
AWA
VAV
HHH
Poopaye 2016-09-04
  • 打赏
  • 举报
回复
字体还有个叫kerning的属性,就是两个字符之间连在一起写时候的偏移量 最典型的:VAV,你能明显看到字符间隔缩小了
xuzuning 2016-09-04
  • 打赏
  • 举报
回复
字体分为 等宽字体 和 非等宽 字体 等宽字体一般用于正式文稿 非等宽字体一般用于艺术场合
  • 打赏
  • 举报
回复
不同字体,对于每一个字符宽度的定义不同。同一个字体,对不同字符的宽度的定义也不同。当显示字符串时,宽度不是字符的宽度相加,还包括特意的留白。 盲目计算“字符的宽度”,这可能是只是做 dos 程序或者个别仅仅使用自定义硬件字库(例如某些 pos 打印机的硬字库)时才这样设计的。

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧