|
stone830209
初级用户
 
积分 25
发帖 9
注册 2006-4-1
状态 离线
|
『楼 主』:
dos字体问题
使用 LLM 解释/回答一下
我在做程序的图形界面的时候,要用到许多不同的字体,这些字体windows都有,比如仿宋,新魏,等等,我想问问大家dos下运行的程序(16位,32位的都行),有没有方便些的字体解决方案,实现windows字体的显示。谢谢
When I am making the graphical interface of the program, I need to use many different fonts, and these fonts are all available in Windows, such as FangSong, XinWei, etc. I want to ask everyone, for the programs running under DOS (both 16-bit and 32-bit), is there a more convenient font solution to realize the display of Windows fonts?
|
|
2006-9-20 05:13 |
|
|
stone830209
初级用户
 
积分 25
发帖 9
注册 2006-4-1
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
希望看到本贴的朋友能帮顶一下,如果觉得这个问题很幼稚,那也请您在百忙之中,点拨一二,也许您的几句话就帮了我很大的忙。谢谢了
Hope that friends who see this post can help top it. If you think this question is very naive, please also give me a little guidance in your busy schedule. Maybe a few words from you will help me a lot. Thank you.
|
|
2006-9-20 07:37 |
|
|
本是
银牌会员
    
积分 2221
发帖 789
注册 2005-1-27
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
请到汉化版找“本是”在VGA文本汉字显示的贴子里提供过!
Please go to the Chinese version to find the post where "Benshi" provided about VGA text Chinese character display!
|

my major is english----my love is dos----my teacher is the buddha----my friends--how about U |
|
2006-9-20 12:09 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
DOS下的16*16点阵中文字只有默认的宋体字最好看
Among 16x16 dot matrix Chinese characters under DOS, only the default SimSun font looks the best
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2006-9-22 11:06 |
|
|
stone830209
初级用户
 
积分 25
发帖 9
注册 2006-4-1
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
首先非常感谢两位高手的回答,不过我想知道的是一些原理性的东西,或者一个具体的方案,比如我现在正着手的一个方案是,像vb的picturebox控件中用我想要的windows字体写入所有ascII码字符,然后逐个扫描,生成该字体的所有ascII字模。其实总结一下,我的问题就是,希望大家给提供一些,生成字模的方案,或者你曾经实现的思路。谢谢
|
|
2006-9-22 20:56 |
|
|
stone830209
初级用户
 
积分 25
发帖 9
注册 2006-4-1
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
对了顺便说一下,我用picturebox控件生成字模的时候,有个地方感觉很别扭,就是字体大小的问题,由于要逐个扫描picturebox中的字符,所以关键的一点是要知道该种字体字符占多少像素,比如16*16或32*32,但是windows字体大小的单位都是磅,所以我的办法是,扫描一个字符,然后测出它的长宽边界,用这个边界做为以后显示和扫描的字体长宽像素值,我总感觉这种办法挺别扭的,希望大家也给指点一下。
By the way, when I use the PictureBox control to generate the character font, there is a place that feels very awkward, that is, the issue of font size. Since I need to scan the characters in the PictureBox one by one, the key point is to know how many pixels the character of this font occupies, such as 16*16 or 32*32. But the units of Windows font size are all points. So my method is to scan a character and then measure its length and width boundaries, and use this boundary as the length and width pixel values of the font for future display and scanning. I always feel this method is quite awkward, and I hope everyone can also give some pointers.
|
|
2006-9-22 21:15 |
|
|
zyl910
中级用户
  
积分 282
发帖 126
注册 2006-5-17
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
1 缇 = 1/1440 英寸
1 磅 = 1/72 英寸 = 20 缇
但将这些单位化为像素就比较复杂了:
水平方向1英寸= GetDeviceCaps(hDC, LOGPIXELSX) 像素
垂直方向1英寸= GetDeviceCaps(hDC, LOGPIXELSY) 像素
GetDeviceCaps是一个GDI API,用于得到DC的属性
hDC是你绘图所用的DC,如: Picture1.hDC
所以字体高度一般是这样计算的:
lfHeight = PointSize * GetDeviceCaps(hDC, LOGPIXELSY) / 72
由于Screen对象的TwipsPerPixelX、TwipsPerPixelY属性可以得知一像素是多少缇,所以可以这样计算:
lfHeight = PointSize * 20 / Screen.TwipsPerPixelY
1 twip = 1/1440 inch
1 point = 1/72 inch = 20 twips
But it is more complicated to convert these units to pixels:
Horizontal 1 inch = GetDeviceCaps(hDC, LOGPIXELSX) pixels
Vertical 1 inch = GetDeviceCaps(hDC, LOGPIXELSY) pixels
GetDeviceCaps is a GDI API used to get the properties of the DC
hDC is the DC you use for drawing, such as: Picture1.hDC
So the font height is generally calculated like this:
lfHeight = PointSize * GetDeviceCaps(hDC, LOGPIXELSY) / 72
Since the Screen object's TwipsPerPixelX, TwipsPerPixelY properties can be used to know how many twips are in one pixel, so it can be calculated like this:
lfHeight = PointSize * 20 / Screen.TwipsPerPixelY
|

人类存在的目的就是试图理解人类为何存在 |
|
2006-9-22 21:52 |
|
|
zyl910
中级用户
  
积分 282
发帖 126
注册 2006-5-17
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
文本排版是很复杂的
用GetTextMetrics可以取得当前字体的排版信息,GetOutlineTextMetrics可以进一步得到TTF字体的排版信息
GetCharABCWidths、GetCharABCWidthsFloat可以的到字体的左右悬挂属性,用于非等宽字体或斜体状态,可以使一个一个字符的某一部分位于另一个字符的单元格内,如: fffffff
用GetTextExtentPoint32计算一字符串在该DC绘制后所占的尺寸
Text layout is very complicated.
You can use GetTextMetrics to obtain the text layout information of the current font, and GetOutlineTextMetrics can further obtain the text layout information of TTF fonts.
GetCharABCWidths and GetCharABCWidthsFloat can obtain the left and right hanging attributes of the font, which are used for non - monospaced fonts or italic states, allowing a part of one character to be located within the cell of another character, such as: fffffff
Use GetTextExtentPoint32 to calculate the size occupied by a string after drawing on this DC
|

人类存在的目的就是试图理解人类为何存在 |
|
2006-9-22 22:05 |
|
|
stone830209
初级用户
 
积分 25
发帖 9
注册 2006-4-1
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
非常感谢,恕我愚钝,没看太懂,我再研究研究你的帖啊 ,谢谢啊
Thank you very much. I'm sorry I'm slow-witted and didn't understand much. I'll study your post again. Thanks.
|
|
2006-9-25 07:12 |
|
|
pcwawa
初级用户
 
积分 118
发帖 10
注册 2004-6-15
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
自己做个专用的字库和写字函数,或者自己设计CHR字体。
偶有一个制作CHR字库的软件,可制中文的CHR字库,不过每个文件最多只能放255个汉字。
Make your own dedicated font library and writing function, or design your own CHR font.
There is a software for making CHR font libraries, which can make Chinese CHR font libraries, but each file can hold at most 255 Chinese characters.
|
|
2006-11-1 10:32 |
|
|
pcwawa
初级用户
 
积分 118
发帖 10
注册 2004-6-15
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
如果你自己做字库,请先决定做等宽的字体还是做变宽的,实现起来大不相同啊。
If you make your own font, first decide whether to make a monospaced font or a proportional font. The implementation is very different!
|
|
2006-11-1 10:34 |
|
|
pcwawa
初级用户
 
积分 118
发帖 10
注册 2004-6-15
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
回复完了才发现是stone,呵呵
I just noticed it's stone after replying, heh
|
|
2006-11-1 10:34 |
|