[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] [PATCH] CJK Autohinter should not clump stems together wh
From: |
mpsuzuki |
Subject: |
Re: [ft-devel] [PATCH] CJK Autohinter should not clump stems together when there are too many of them |
Date: |
Wed, 20 Apr 2011 19:07:27 +0900 |
Hi,
Sorry for lated review of your patch. I made slight revise
to your patch, it's almost ready to commit.
One of my anxiety was that the priority to the black/white
evenness can reduce the contrast of the complex glyph.
Please find attached picture comparing the results by
HeiseiMaruGo-W4 at 16pt @ 72dpi. In my personal impression,
the legibility of the strokes in enclosed area (like "日"
or "目") is not important, but the legibility of the longest
stroke should be respected. Please let me know how your
opinion.
Regards,
mpsuzuki
diff --git a/builds/unix/install-sh b/builds/unix/install-sh
old mode 100644
new mode 100755
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index af4597c..a291fc3 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -1025,6 +1025,8 @@
AF_Edge anchor = 0;
FT_Pos delta = 0;
FT_Int skipped = 0;
+ FT_Bool has_last_stem = 0;
+ FT_Pos last_stem_pos = 0;
/* now we align all stem edges. */
@@ -1044,12 +1046,34 @@
continue;
}
+ /* Some CJK characters have so many stems that
+ * the hinter is likely to merge two adjacent ones.
+ * To solve this problem, if either edge of a stem
+ * is too close to the previous one, we avoid
+ * aligning the two edges, but rather interpolate
+ * their locations at the end of this function in
+ * order to preserve the space between the stems.
+ */
+ if ( has_last_stem &&
+ ( edge->pos < last_stem_pos + 64 ||
+ edge2->pos < last_stem_pos + 64 ) )
+ {
+ skipped++;
+ continue;
+ }
+
/* now align the stem */
if ( edge2 < edge )
{
af_cjk_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
+ /* We rarely reaches here it seems;
+ * usually the two edges belonging
+ * to one stem are marked as DONE together
+ */
+ has_last_stem = 1;
+ last_stem_pos = edge->pos;
continue;
}
@@ -1142,6 +1166,8 @@
anchor = edge;
edge->flags |= AF_EDGE_DONE;
edge2->flags |= AF_EDGE_DONE;
+ has_last_stem = 1;
+ last_stem_pos = edge2->pos;
}
/* make sure that lowercase m's maintain their symmetry */
On Sun, 20 Feb 2011 16:11:22 +0900
address@hidden wrote:
>Hi,
>
>On Sun, 20 Feb 2011 07:43:54 +0100 (CET)
>Werner LEMBERG <address@hidden> wrote:
>>> Some Chinese characters, such as 量 and 置, have a large number of
>>> horizontal stems. At ordinary sizes, the autohinter will often
>>> clump adjacent stems together; although the result remains readable,
>>> the unevenness of black and white looks rather ugly.
>>>
>>> afcjk.patch is my patch that attempts to solve this problem. All
>>> stems that are pixel-aligned have at least one pixel of space (or
>>> other stems) in between. Other stems are not aligned, but only have
>>> their position interpolated, so they have the un-hinted look which
>>> is IMHO better.
>>
>>Thanks for your patch; it looks reasonable. Toshiya-san, could you
>>please comment?
>
>Indeed, the rasterization result of patched version is
>better than original version. I want to check if it
>works well for other fonts, especially the typeface
>using non-flat-width strokes, like KaiShu. Please give
>me 1 or 2 weeks...
>
>Regards,
>mpsuzuki
>
>_______________________________________________
>Freetype-devel mailing list
>address@hidden
>http://lists.nongnu.org/mailman/listinfo/freetype-devel
HeiseiMaruGo.png
Description: PNG image
- Re: [ft-devel] [PATCH] CJK Autohinter should not clump stems together when there are too many of them,
mpsuzuki <=