Bugzilla – Attachment 101395 Details for
Bug 158573
<Tradition Chinese Font are different.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
Patch against freetype 2.2.1
freetype-fix-contour-orientation-detection.diff (text/plain), 6.09 KB, created by
Zhe Su
on 2006-10-13 06:26:23 UTC
(
hide
)
Description:
Patch against freetype 2.2.1
Filename:
MIME Type:
Creator:
Zhe Su
Created:
2006-10-13 06:26:23 UTC
Size:
6.09 KB
patch
obsolete
>--- src/base/ftoutln.c.old 2006-10-13 13:20:55.000000000 +0800 >+++ src/base/ftoutln.c 2006-10-13 13:57:56.000000000 +0800 >@@ -933,18 +933,21 @@ > FT_EXPORT_DEF( FT_Orientation ) > FT_Outline_Get_Orientation( FT_Outline* outline ) > { >- FT_Pos xmin = 32768L; >- FT_Vector* xmin_point = NULL; >- FT_Vector* xmin_first = NULL; >- FT_Vector* xmin_last = NULL; >+ FT_Vector xmin = { 32768L, 32768L }; >+ FT_Vector xmin_p; >+ FT_Vector xmin_n; >+ >+ FT_Vector* xmin_prev = NULL; >+ FT_Vector* xmin_next = NULL; >+ FT_Vector* xmin_first = NULL; >+ FT_Vector* xmin_last = NULL; >+ >+ int xmin_points = 0; > > short* contour; > > FT_Vector* first; > FT_Vector* last; >- FT_Vector* prev; >- FT_Vector* next; >- > > if ( !outline || outline->n_points <= 0 ) > return FT_ORIENTATION_TRUETYPE; >@@ -955,10 +958,13 @@ > contour++, first = last + 1 ) > { > FT_Vector* point; >- FT_Int on_curve; >- FT_Int on_curve_count = 0; >- FT_Pos tmp_xmin = 32768L; >- FT_Vector* tmp_xmin_point = NULL; >+ FT_Vector* prev; >+ FT_Vector* next; >+ >+ FT_Vector contour_xmin = { 32768L, 32768L }; >+ FT_Vector* contour_xmin_prev; >+ FT_Vector* contour_xmin_next; >+ int contour_count = 0; > > last = outline->points + *contour; > >@@ -966,54 +972,114 @@ > if ( last < first + 2 ) > continue; > >+ prev = last; > for ( point = first; point <= last; ++point ) > { >- /* Count on-curve points. If there are less than 3 on-curve */ >- /* points, just bypass this contour. */ >- on_curve = outline->tags[point - outline->points] & 1; >- on_curve_count += on_curve; >+ FT_Vector tmp_xmin = { 32768L, 32768L }; >+ FT_Vector* tmp_prev; >+ FT_Vector* tmp_next; >+ >+ if ( point == last ) >+ next = first; >+ else >+ next = point + 1; >+ >+ /* If it's a on-curve point, then just use it */ >+ if ( outline->tags[point - outline->points] & 1 ) >+ { >+ tmp_xmin = *point; >+ tmp_prev = prev; >+ tmp_next = next; >+ } >+ /* If it's an off-curve point and the prev point is also an >+ of-curve point, then use the implicit on-curve point between >+ them. */ >+ else if ( (outline->tags[prev - outline->points] & 1) == 0 ) >+ { >+ tmp_xmin.x = ((point->x + prev->x) >> 1); >+ tmp_xmin.y = ((point->y + prev->y) >> 1); >+ tmp_prev = prev; >+ tmp_next = point; >+ } >+ >+ if ( tmp_xmin.x != 32768L ) >+ ++contour_count; > >- if ( point->x < tmp_xmin && on_curve ) >+ if ( tmp_xmin.x < contour_xmin.x ) > { >- tmp_xmin = point->x; >- tmp_xmin_point = point; >+ contour_xmin = tmp_xmin; >+ contour_xmin_prev = tmp_prev; >+ contour_xmin_next = tmp_next; > } >+ >+ prev = point; > } > >- if ( on_curve_count > 2 && tmp_xmin < xmin ) >+ if ( contour_xmin.x < xmin.x ) > { >- xmin = tmp_xmin; >- xmin_point = tmp_xmin_point; >- xmin_first = first; >- xmin_last = last; >+ xmin = contour_xmin; >+ xmin_prev = contour_xmin_prev; >+ xmin_next = contour_xmin_next; >+ xmin_first = first; >+ xmin_last = last; >+ xmin_points = contour_count; > } > } > >- if ( !xmin_point ) >+ if ( xmin.x == 32768L ) > return FT_ORIENTATION_TRUETYPE; > >- prev = ( xmin_point == xmin_first ) ? xmin_last : xmin_point - 1; >- next = ( xmin_point == xmin_last ) ? xmin_first : xmin_point + 1; >- >- /* Skip off-curve points */ >- while ( ( outline->tags[prev - outline->points] & 1 ) == 0 ) >+ /* if there are less than 3 on-curve points, then just use >+ the prev and next points, no matter whether they are on-curve >+ points or not. */ >+ if ( xmin_points < 3 ) > { >- if ( prev == xmin_first ) >- prev = xmin_last; >- else >- --prev; >+ xmin_p = *xmin_prev; >+ xmin_n = *xmin_next; > } >- >- while ( ( outline->tags[next - outline->points] & 1 ) == 0 ) >+ /* If there are 3 or more on-curve points, then try to find >+ better prev and next points. */ >+ else > { >- if ( next == xmin_last ) >- next = xmin_first; >+ /* Find a valid prev point */ >+ if ( outline->tags[xmin_prev - outline->points] & 1 ) >+ xmin_p = *xmin_prev; > else >- ++next; >+ { >+ FT_Vector *prev2 = ( xmin_prev == xmin_first ) ? xmin_last : xmin_prev - 1; >+ /* If the second prev point is an on-curve point, then use it */ >+ if ( outline->tags[prev2 - outline->points] & 1 ) >+ xmin_p = *prev2; >+ /* If the second prev point is also an off-curve point, then use >+ the middle point between prev and prev2. */ >+ else >+ { >+ xmin_p.x = ((xmin_prev->x + prev2->x) >> 1); >+ xmin_p.y = ((xmin_prev->y + prev2->y) >> 1); >+ } >+ } >+ >+ /* Find a valid next point. */ >+ if ( outline->tags[xmin_next - outline->points] & 1 ) >+ xmin_n = *xmin_next; >+ else >+ { >+ FT_Vector *next2 = ( xmin_next == xmin_last ) ? xmin_first : xmin_next + 1; >+ /* If the second next point is an on-curve point, then use it */ >+ if ( outline->tags[next2 - outline->points] & 1 ) >+ xmin_n = *next2; >+ /* If the second next point is also an off-curve point, then use >+ the middle point between next and next2. */ >+ else >+ { >+ xmin_n.x = ((xmin_next->x + next2->x) >> 1); >+ xmin_n.y = ((xmin_next->y + next2->y) >> 1); >+ } >+ } > } > >- if ( FT_Atan2( prev->x - xmin_point->x, prev->y - xmin_point->y ) > >- FT_Atan2( next->x - xmin_point->x, next->y - xmin_point->y ) ) >+ if ( FT_Atan2( xmin_p.x - xmin.x, xmin_p.y - xmin.y ) > >+ FT_Atan2( xmin_n.x - xmin.x, xmin_n.y - xmin.y ) ) > return FT_ORIENTATION_POSTSCRIPT; > else > return FT_ORIENTATION_TRUETYPE;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 158573
:
73283
|
73284
|
73306
|
73444
|
73445
|
73674
|
73726
| 101395 |
101396
|
101397
|
101492
|
101493
|
101863
|
101864
|
102025
|
102295