freetype-py icon indicating copy to clipboard operation
freetype-py copied to clipboard

freetype.ft_errors.FT_Exception: FT_Exception: (raster overflow)

Open ronyuzhang opened this issue 6 years ago • 3 comments

freetype.ft_errors.FT_Exception: FT_Exception: (raster overflow)

ronyuzhang avatar Apr 16 '18 06:04 ronyuzhang

Do you have an example font file?

HinTak avatar Apr 16 '18 07:04 HinTak

yes, i have a font ttf file

ronyuzhang avatar Apr 16 '18 08:04 ronyuzhang

Can you attach the test file to this issue page? You may need to zip it up first. GitHub has some restrictions about what type of files can be attached/uploaded to the issue page. But zip file is fine.


On Mon, 16/4/18, ronyuzhang [email protected] wrote:

yes, i have a font ttf file

HinTak avatar Apr 16 '18 09:04 HinTak

Hello, I also encountered this problem, using the Song font library of Windows. The error font is '頁' and The err code is 98. STSONG.zip

qingfusheng avatar Oct 30 '22 06:10 qingfusheng

@qingfusheng can you supply the actual code (or portion of) to trigger the error with this font? Granted it is quite old - 20+ years ! - so could be buggy, but current freetype seems to cope just fine loading every glyph at 10pt with ftview.

HinTak avatar Oct 31 '22 21:10 HinTak

Here is what I have checked (besides ftview mentioned earlier):

  • fontvalidator (just follow my profile etc) - while the font itself has a number of warnings / errors, none of it could cause a raster overflow. It is not surprising given its age (older than fontval, which is 20 years old) .The glyph id of 頁 is 21812, btw. There is a zero length FDEF in the hinting instruction, a some overlapping contours in some other glyphs, but again, no major problems. In particular, glyph id 21812 doesn't have overlapping contours, and in fact simpler than some neighbouring glyphs.
  • the DSIG is intact - font has not been modified post-release from vendor
  • fontval's rasterization test runs alright other than the above mentioned issues - that covers most of the smaller sizes plus up to size 255, especially for glyph id 21812.

Then I have a look at the current freetype code - it is actually quite difficult to get raster overflow errors - and it happens for quite special circumstances/usage/code-path, and if you try to bitmap larger than 65536 (or maybe about 20,000 x 20,000, for some usage - sub-pixel rendering / sdf ).

So my conclusion is probably either you accidentally try to do a 20,000 x 20,000 bitmap, or some special usage... in any case, I can't see anything wrong with current freetype.

So, probably give it another try, or post the actual code you are using (subset of),.

HinTak avatar Sep 03 '23 22:09 HinTak