Bug 8093 - bitmap-only TTF support
Summary: bitmap-only TTF support
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.2
Hardware: All All
: high normal
Assignee: Keith Packard
QA Contact:
URL: http://lists.freedesktop.org/archives...
Whiteboard:
Keywords:
Depends on:
Blocks: 14062
  Show dependency treegraph
 
Reported: 2006-08-31 20:23 UTC by suzuki toshiya
Modified: 2014-07-19 10:05 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch to use specified bitmap strike for glyph availability check (2.69 KB, patch)
2006-08-31 20:25 UTC, suzuki toshiya
Details | Splinter Review
TTF-packed font that I and Qianqian Fang discussed (950.00 KB, application/octet-stream)
2007-11-15 17:43 UTC, suzuki toshiya
Details
TTF-packed font that I and Qianqian Fang discussed (927.91 KB, application/octet-stream)
2007-11-15 17:44 UTC, suzuki toshiya
Details
Look for glyphs in a bitmap when the glyf table is missing (4.74 KB, patch)
2008-05-03 17:17 UTC, Keith Packard
Details | Splinter Review

Description suzuki toshiya 2006-08-31 20:23:23 UTC
As Qianqian Fang reported, fc-cache cannot recognize bitmap-only TTF well.
I wrote a patch to scan a strike instead of glyf table (specified by setting
environmental variable FC_BITMAP_SIZE), by hooking FcFreeTypeCheckGlyph().
Although I wrote for obsolete fontconfig-2.2.3, but I suppose it can be
applicable to latest fontconfig.
Comment 1 suzuki toshiya 2006-08-31 20:25:27 UTC
Created attachment 6773 [details] [review]
patch to use specified bitmap strike for glyph availability check

When environmental variable is set as FC_BITMAP_SIZE="12,14,0,16,18",
fc-cache lookups 12pixel strike for first. If the font provide it,
fc-cache checks the glyph availability by glyph data by 12pixel strike.
If the font has no 12pixel strike, fc-cache lookups 14pixel in next.
If the font has no 12/14pixel strikes, fc-cache lookups vector data
in next. If the font has no 12/14pixel strike or vector data, fc-cache
lookups 16pixel strike in next...
Comment 2 Behdad Esfahbod 2007-10-25 08:32:25 UTC
Keith, anything to pick from this bug?
Comment 3 Keith Packard 2007-10-25 14:46:47 UTC
we'd need to have a font that doesn't currently work; every bitmap-only TTF I've created has a glyf table, making this patch unnecessary.
Comment 4 suzuki toshiya 2007-11-15 17:43:24 UTC
Created attachment 12576 [details]
TTF-packed font that I and Qianqian Fang discussed

Behdad, thank you for reminding this to Keith.

This is the bitmap-only TrueType font that I
and Qianqian Fang discussed (and I wrote the
patch for). The file is too large to fit within 1MB,
I divide it into 2 parts.
Comment 5 suzuki toshiya 2007-11-15 17:44:06 UTC
Created attachment 12577 [details]
TTF-packed font that I and Qianqian Fang discussed

here is part 2.
Comment 6 suzuki toshiya 2007-11-15 17:49:31 UTC
fontconfig-2.4.91 generates following line into cache:

"wqy-bsong.ttf" 0 "WenQuanYi Bitmap Song,文泉驿点阵宋体
:familylang=en,zh-sg:style=medium:stylelang=en:
fullname=WenQuanYi Bitmap Song-medium:fullnamelang=en:slant=0:weight=100:width=100
:pixelsize=12,13,15,16:spacing=100:foundry=unknown
:antialias=False:index=0:outline=False:scalable=False
:charset=:lang=:fontversion=45875
:capability=otlayout\\:DFLT:fontformat=TrueType:decorative=False"

As you can find, the charset is empty.
That's what I and Qianqian Fang were trying to fix.
Comment 7 Keith Packard 2008-05-03 17:17:32 UTC
Created attachment 16336 [details] [review]
Look for glyphs in a bitmap when the glyf table is missing

This patch checks fonts which have no glyphs to see if they are fixed-size true type fonts. If so, it then selects a single size (nearest 16 pixels) and uses that to measure the font coverage.

Please test and report back if it doesn't work for you.
Comment 8 Keith Packard 2008-05-24 16:17:57 UTC
I haven't heard any response to the proposed patch (which is in master), so I'm closing this bug.
Comment 9 suzuki toshiya 2008-05-24 21:19:42 UTC
At present I don't have a time to execute comprehensive checking,
but I confirmed that wqy-bsong.ttf (I attached ever) is recognized
as non-empty TTF. Anyway the situation was improved. Thanks.

There are two points I have to consider.

* the patch tries to check bitmap table when FcCharSetCount is zero.
  If a TTF has only a few outline glyphs (e.g. Roman characters) and
  many bitmap glyphs (e.g. CJK ideographs), how fontconfig should
  handle it?

* the patch check the pixel size which is the nearest size to 16pixel.
  I guess 10-14 pixels are popular among CJK bitmap only fonts.
  I wish if the size is configurable in ./configure options.
  
Comment 10 Keith Packard 2008-05-24 22:53:08 UTC
If the font has any outline characters, it will need a glyf table to map them. Until we find a counter example, we'll assume that any sane font will have a complete glyf table if it has any glyf entries.

Also, it only looks at a single bitmap instance; assuming (once again, until we find a counter example) that a font will have all of the same bitmaps at each size, and not subset them at some sizes.

I strongly prefer not providing configuration until we find a place where it is needed, and even then, it would be best to figure out a mechanism which doesn't require that the user "know" about the fonts they are installing.
Comment 11 suzuki toshiya 2008-05-24 23:38:24 UTC
OK, when I find a TTF described as above (the coverage of glyf
table is smaller than that of bitmap tables), I will file another
entry in bugzilla. Thus I have no objection to close this bug now.
Comment 12 Chris Wilson 2014-07-19 10:05:22 UTC
*** Bug 81375 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.