![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-01 19:40 |
48,037 topics / 350,122 posts / today 2 new / 48,249 members |
| DOS开发编程 & 发展交流 (开发室) » DOS font issue |
| Printable Version 2,587 / 11 |
| Floor1 stone830209 | Posted 2006-09-20 05:13 |
| 初级用户 Posts 9 Credits 25 | |
|
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?
|
|
| Floor2 stone830209 | Posted 2006-09-20 07:37 |
| 初级用户 Posts 9 Credits 25 | |
|
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.
|
|
| Floor3 本是 | Posted 2006-09-20 12:09 |
| 银牌会员 Posts 790 Credits 2,227 | |
|
Please go to the Chinese version to find the post where "Benshi" provided about VGA text Chinese character display!
|
|
| Floor4 JonePeng | Posted 2006-09-22 11:06 |
| 金牌会员 Posts 1,883 Credits 4,562 From 广东广州 | |
|
Among 16x16 dot matrix Chinese characters under DOS, only the default SimSun font looks the best
|
|
| Floor5 stone830209 | Posted 2006-09-22 20:56 |
| 初级用户 Posts 9 Credits 25 | |
| Floor6 stone830209 | Posted 2006-09-22 21:15 |
| 初级用户 Posts 9 Credits 25 | |
|
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.
|
|
| Floor7 zyl910 | Posted 2006-09-22 21:52 |
| 中级用户 Posts 126 Credits 282 | |
|
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 |
|
| Floor8 zyl910 | Posted 2006-09-22 22:05 |
| 中级用户 Posts 126 Credits 282 | |
|
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 |
|
| Floor9 stone830209 | Posted 2006-09-25 07:12 |
| 初级用户 Posts 9 Credits 25 | |
|
Thank you very much. I'm sorry I'm slow-witted and didn't understand much. I'll study your post again. Thanks.
|
|
| Floor10 pcwawa | Posted 2006-11-01 10:32 |
| 初级用户 Posts 10 Credits 118 | |
|
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. |
|
| Floor11 pcwawa | Posted 2006-11-01 10:34 |
| 初级用户 Posts 10 Credits 118 | |
|
If you make your own font, first decide whether to make a monospaced font or a proportional font. The implementation is very different!
|
|
| Floor12 pcwawa | Posted 2006-11-01 10:34 |
| 初级用户 Posts 10 Credits 118 | |
|
I just noticed it's stone after replying, heh
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |