将已安装的字体转换为二进制或十六进制数据 [英] Converting an Installed Font to a binary or Hex data

查看:128
本文介绍了将已安装的字体转换为二进制或十六进制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我要创建单色LED显示屏.
我想编写一个代码,可以将系统上的任何安装字体转换为二进制(例如8 * 8或16 * 16)数据.
有什么解决办法吗?
欢迎所有建议.
问候
R.Mohseni.

Hello everybody
I''m going to create a single-color LED display.
I want to write a code that can convert any install font on the system to a binary (e.g 8*8 or 16*16) data.
Is there any solution?
All suggestion and recommendation are welcomed.
Regards
R.Mohseni.

推荐答案

不是一个好主意.字体是非常复杂的东西,当您尝试将其减小到8像素左右时,字体缩放效果不佳.

如果坚持这种方法,请使用Font.Height属性以及设置为GraphicsUnit.Pixel的字体的Unit属性,然后将整个字体绘制到所需高度的位图上.但是它不能很好地工作:大多数字体都是按比例隔开的,因此"i"比"W"要窄很多,依此类推.

最好的结果是,如果将自己的字符映射到您选择的大小并显示它们.



非常感谢您的回答.
您有更好的主意吗?"



就像我说的那样,如果您希望它看起来不错,则必须搜索8 * 7或16 * 15的矩阵字体.

这些东西的正常大小为5 * 7(奇数更容易适合西方字符)及以上:Google提供了"5x7 LCD字体源代码",这应该会让您入门.
好像以前没有做过几次-我想我已经用三种不同的汇编器C,C ++以及可能我忘记使用的几种语言创建了基本的字符形状... :laugh:
Not a good idea. Fonts are hugely complicated things, which do not scale well when you try to reduce them to 8 or so pixels.

If you insist on this approach, use the Font.Height property, together with the Unit property of the font set to GraphicsUnit.Pixel, and draw the entire font onto a bitmap at the height you want. It won''t work well though: most of the fonts are proportionally spaced, so "i" is a lot narrower than "W", and so forth.

The best result will be if you map out your own characters into your chosen size and display them.



"Thank so much of your answer.
Do you have a better idea?"



As I said, if you want it to look good, you will either have to search for a 8*7 or 16 * 15 matrix font.

Normal sizes for these things are 5*7 (odd numbers are easier to fit western characters into) and on up: Google for "5x7 LCD font source code" and that should get you started.
It''s not as if this hasn''t been done a few times before - I think I have created basic character shapes in three different assemblers, C, C++, and probably a few languages I''ve forgotten using... :laugh:


这篇关于将已安装的字体转换为二进制或十六进制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆