I see, the incomplete code is your intention, and you don't want to make a 
self-standing test program.

Taking a look on your source, I guess your intent of the code would be:
1) set the 4th bitmap strike, by calling "FT_Select_Size(face, 4)".
2) load a bitmap glyph for U+00A4 (currency sign, "¤"), by calling "__draw_ft_char(0, 0, 
0x00A4, &height, &width);"
3) load a bitmap glyph for U+0041 (latin capital letter A, "A"), by calling 
"__draw_ft_char(0, 0, 0x0041, &height, &width);

1) & 2) works successfully, but 3) fails. And you think 3) is a bug (or 
something to be improved) of FreeType2.

--

I don't think SimSun includes a bitmap data for "A" (U+0041).

What you see in FontForge window for "A" is not an embedded bitmap, but a 
runtime-generated bitmap calculated by FontForge, on the fly. Maybe, when you open the 
file and select a bitmap strike, the character chart would display red box for U+0041. If 
you click the red box, fontforge would calculate the bitmap glyph in runtime.

If you dump SimSun by fonttools by Just van Rossum, 
https://github.com/fonttools/fonttools ,
you can find an XML element for the embedded bitmap for "currency" (U+00A4), 
like,

      <ebdt_bitmap_format_1 name="currency">
        <SmallGlyphMetrics>
          <height value="9"/>
          <width value="9"/>
          <BearingX value="1"/>
          <BearingY value="9"/>
          <Advance value="12"/>
        </SmallGlyphMetrics>
        <rawimagedata>
          80805d00 22004100 41004100 22005d00
          8080
        </rawimagedata>
      </ebdt_bitmap_format_1>

But there is no an XML element for the embedded bitmap for "A" (U+0041). You 
would NOT find an XML element like
      <ebdt_bitmap_format_1 name="A">
      ...
      </ebdt_bitmap_format_1>
There is no such. So SimSun does not bitmap data for "A".

You should understand that some glyphs in a font may have both of outline and 
bitmap data, but other glyphs in same font may have outline only, or, bitmap 
only.

Regards,
mpsuzuki

On 2024/12/06 0:04, 大牙开心就好 wrote:
Hi,

test.c is a part of my test code about freetype2, which is indeed incomplete, 
but could you put the functions in test.c into your project and run the test 
function.

1.Call the test() function in your project's mian() function.
2.ff_convert() can be commented out and ignored.
3._T() depends on whether the string used by the file system is utf-16 or utf-8.

I have fully supplemented test.c

Thank you!
_T() depends on whether the string used by the file system is utf-16 or utf-8
________________________________
<https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=%E5%A4%A7%E7%89%99%E5%BC%80%E5%BF%83%E5%B0%B1%E5%A5%BD&icon=https%3A%2F%2Fres.mail.qq.com%2Fzh_CN%2Fhtmledition%2Fimages%2Frss%2Fmale.gif%3Frand%3D1617349242&mail=990087812%40qq.com&code=>
[https://res.mail.qq.com/zh_CN/htmledition/images/rss/male.gif?rand=1617349242]
大牙开心就好
990087...@qq.com



------------------ 原始邮件 ------------------
发件人: "suzuki toshiya" <mpsuz...@hiroshima-u.ac.jp>;
发送时间: 2024年12月5日(星期四) 晚上10:39
收件人: "freetype"<freetype@nongnu.org>;
抄送: "大牙开心就好"<990087...@qq.com>;
主题: Re: 回复: About freetype2 bitmap strike

I'm unsure whether this is really the code that you tested.
Attached test.c is not buildable, because of following problems.

1) test.c has no main() function.

2) test.c includes no header files. no freetype header file, no standard C 
header file (like stdint.h to use uint16_t)

3) test.c is not self-standing code, it calls some external functions or 
macros. _T(), ff_convert() are not defined.

Regards,
mpsuzuki

On 2024/12/05 15:02, 大牙开心就好 wrote:
Hi,

The attachment contains the test code and font.

test result:
[https://mail.qq.com/cgi-bin/viewfile?f=0C30B02BD5A828EE573EEE1B2A7B2299C21365D1FC48CD6EB08B080841116823DD236A8D7AAECFDE201B9EFA152076E4F79A612F8E0F55779029CF61F0E82AE30CFBB714D0C45DF7FFBB6C91810768F213B994676C239C7253CDD6CF4B0F2E24&mailid=ZL0105-%7EHziUtiZLC9%7EHiVCO9t%7EDec&sid=X9tNkBof7u28NA9o&net=1069200670]

I don't know if this is a bug or some other reason, I hope to get your 
help,Thank you.

________________________________
<https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=%E5%A4%A7%E7%89%99%E5%BC%80%E5%BF%83%E5%B0%B1%E5%A5%BD&icon=https%3A%2F%2Fres.mail.qq.com%2Fzh_CN%2Fhtmledition%2Fimages%2Frss%2Fmale.gif%3Frand%3D1617349242&mail=990087812%40qq.com&code=>
[https://res.mail.qq.com/zh_CN/htmledition/images/rss/male.gif?rand=1617349242]
大牙开心就好
990087...@qq.com



------------------ 原始邮件 ------------------
发件人: "freetype@nongnu.org" <mpsuz...@hiroshima-u.ac.jp>;
发送时间: 2024年12月5日(星期四) 中午1:25
收件人: "freetype"<freetype@nongnu.org>;
抄送: "大牙开心就好"<990087...@qq.com>;
主题: Re: About freetype2 bitmap strike

Hi,

Could you post your testing code written in C?
(please do not copy & paste it in your HTML email, please post as an attachment)

Regards,
mpsuzuki

P.S.
I hope you can reply to freetype@nongnu.org.
If you reply to me privately with no explanation why it is private, I will post 
it to the public list.
Thanks in advance!

On 2024/12/05 12:38, 大牙开心就好 via FreeType users wrote:
Hi:
&nbsp; &nbsp; I use freetype2 to retrieve the bitmap data embedded in the font, 
Using FT_LOAD_SBIS_ONLY.
In the "simsun.ttf" font, some characters can be obtained while others cannot.
Use "FontForge" software to view that these characters all contain bitmap data.


for example:
&nbsp; &nbsp; characters "¤", its Unicode is 0x00A4,The bitmap data obtained 
using freetype2 is consistent with the bitmap data viewed using FontForge software.
As shown in the following figure.

&nbsp; &nbsp;







&nbsp; &nbsp; But, characters "A", its Unicode is 0x0041,Freetype2 cannot 
obtain bitmap data. But using FontForge software, it can be seen that there is bitmap data.

As shown in the following figure.








My test code:

int ft_error;

FT_Select_Size(face, 4);

ft_error = FT_Load_Char(face, 0x00A4, FT_LOAD_RENDER | FT_LOAD_SBITS_ONLY | 
FT_LOAD_MONOCHROME);

ft_error is 0;

&nbsp;

ft_error = FT_Load_Char(face, 0x0041, FT_LOAD_RENDER | FT_LOAD_SBITS_ONLY | 
FT_LOAD_MONOCHROME);

ft_error is 6;




&nbsp; &nbsp; I found that the error occurred in tt_stit_decoder_load_image 
function and returns NoBitmap.

But use "FontForge" software open the "simsun.ttf" and view characters "A",We 
can see that it has bitmap data.

I don't know if this is a bug or some other reason, I hope to get your 
help,Thank you.




My freetype2 version is V2.13.0, and the attachment is the "simsun. ttf" font.







大牙开心就好
990087...@qq.com



&nbsp;


Reply via email to