adobe-fonts / source-han-sans

Source Han Sans | 思源黑体 | 思源黑體 | 思源黑體 香港 | 源ノ角ゴシック | 본고딕
Other
14.4k stars 1.3k forks source link

Gridfit #3

Closed be5invis closed 10 years ago

be5invis commented 10 years ago

Gridfitted TTFs are extremely useful for low-density display devices and web use, however there is still NO CJK font which is well fitted. Gridfits of MSYH often make characters ragged, due to lack of blue zone alignments.

Manually adding gridfits is unacceptable due to the quantity of characters, therefore is it possible to create an automatic gridfit generation algorithm which generates gridfits for thousands of characters? Adding it into ttfautohint might be a great help because people may reuse Source Han Sans in their own composite font and re-generate gridfits.

be5invis commented 6 years ago

@lemzwerg @behdad Another interesting solution for hinting is that, we can grab the intermediate contour from the Adobe rasterizer embedded in Freetype, as described in this article: https://blog.typekit.com/2013/05/01/adobe-contributes-cff-rasterizer-to-freetype/ This image below revealed that Adobe has some very interesting mechanism to deal with complex PS hints: We can have this workflow:

CFF outline --> Adobe rasterizer --> CFF outline under ---.
      |                                a certain PPEM     }---> TT hints
      `-------> Quadratic outline ------------------------'

We rasterize the CFF outline under every size we care about, and match the intermediate contour with the quadratic outline, and encode the intermediate result INTO TT instructions. Using the Adobe words, it is “converting the results of smarts into the form that dumbs can understand”.

lemzwerg commented 6 years ago

Nice idea! Maybe you can tweak ttfautohint to handle this – I still have doubts whether conversion of CFF to TTF is useful, but I agree that there might be situations where a TTF must be used.

be5invis commented 6 years ago

@lemzwerg In TT at least you have more control. Here is the diagram:

CFF --+-> Semantic hints (stems, blues, etc) --> Size-independent TT instr -.
 |    `-> “Hinted” outline under each PPEM   --> Size-dependent TT instr   -+--> TTF
 `------> Quadratic outline ------------------------------------------------’

The size-independent part would be “semantic” hints, while size-dependent part would be a lot of deltas applied to it. For simple glyphs SD part is very little, and for dense glyphs SD part would be significant.