1 /****************************************************************************
2 *
3 * aflatin.c
4 *
5 * Auto-fitter hinting routines for latin writing system (body).
6 *
7 * Copyright (C) 2003-2019 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19 #include <ft2build.h>
20 #include FT_ADVANCES_H
21 #include FT_INTERNAL_DEBUG_H
22
23 #include "afglobal.h"
24 #include "aflatin.h"
25 #include "aferrors.h"
26
27
1893
1894 segment->min_coord = (FT_Short)point->v;
1895 segment->max_coord = (FT_Short)point->v;
1896 segment->height = 0;
1897
1898 on_edge = 0;
1899 segment = NULL;
1900 }
1901 }
1902
1903 point = point->next;
1904 }
1905
1906 } /* contours */
1907
1908
1909 /* now slightly increase the height of segments if this makes */
1910 /* sense -- this is used to better detect and ignore serifs */
1911 {
1912 AF_Segment segments = axis->segments;
1913 AF_Segment segments_end = segments + axis->num_segments;
1914
1915
1916 for ( segment = segments; segment < segments_end; segment++ )
1917 {
1918 AF_Point first = segment->first;
1919 AF_Point last = segment->last;
1920 FT_Pos first_v = first->v;
1921 FT_Pos last_v = last->v;
1922
1923
1924 if ( first_v < last_v )
1925 {
1926 AF_Point p;
1927
1928
1929 p = first->prev;
1930 if ( p->v < first_v )
1931 segment->height = (FT_Short)( segment->height +
1932 ( ( first_v - p->v ) >> 1 ) );
1933
2297 * Good, we now compute each edge's properties according to the
2298 * segments found on its position. Basically, these are
2299 *
2300 * - the edge's main direction
2301 * - stem edge, serif edge or both (which defaults to stem then)
2302 * - rounded edge, straight or both (which defaults to straight)
2303 * - link for edge
2304 *
2305 */
2306
2307 /* first of all, set the `edge' field in each segment -- this is */
2308 /* required in order to compute edge links */
2309
2310 /*
2311 * Note that removing this loop and setting the `edge' field of each
2312 * segment directly in the code above slows down execution speed for
2313 * some reasons on platforms like the Sun.
2314 */
2315 {
2316 AF_Edge edges = axis->edges;
2317 AF_Edge edge_limit = edges + axis->num_edges;
2318 AF_Edge edge;
2319
2320
2321 for ( edge = edges; edge < edge_limit; edge++ )
2322 {
2323 seg = edge->first;
2324 if ( seg )
2325 do
2326 {
2327 seg->edge = edge;
2328 seg = seg->edge_next;
2329
2330 } while ( seg != edge->first );
2331 }
2332
2333 /* now compute each edge properties */
2334 for ( edge = edges; edge < edge_limit; edge++ )
2335 {
2336 FT_Int is_round = 0; /* does it contain round segments? */
2337 FT_Int is_straight = 0; /* does it contain straight segments? */
|
1 /****************************************************************************
2 *
3 * aflatin.c
4 *
5 * Auto-fitter hinting routines for latin writing system (body).
6 *
7 * Copyright (C) 2003-2020 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19 #include <ft2build.h>
20 #include FT_ADVANCES_H
21 #include FT_INTERNAL_DEBUG_H
22
23 #include "afglobal.h"
24 #include "aflatin.h"
25 #include "aferrors.h"
26
27
1893
1894 segment->min_coord = (FT_Short)point->v;
1895 segment->max_coord = (FT_Short)point->v;
1896 segment->height = 0;
1897
1898 on_edge = 0;
1899 segment = NULL;
1900 }
1901 }
1902
1903 point = point->next;
1904 }
1905
1906 } /* contours */
1907
1908
1909 /* now slightly increase the height of segments if this makes */
1910 /* sense -- this is used to better detect and ignore serifs */
1911 {
1912 AF_Segment segments = axis->segments;
1913 AF_Segment segments_end = FT_OFFSET( segments, axis->num_segments );
1914
1915
1916 for ( segment = segments; segment < segments_end; segment++ )
1917 {
1918 AF_Point first = segment->first;
1919 AF_Point last = segment->last;
1920 FT_Pos first_v = first->v;
1921 FT_Pos last_v = last->v;
1922
1923
1924 if ( first_v < last_v )
1925 {
1926 AF_Point p;
1927
1928
1929 p = first->prev;
1930 if ( p->v < first_v )
1931 segment->height = (FT_Short)( segment->height +
1932 ( ( first_v - p->v ) >> 1 ) );
1933
2297 * Good, we now compute each edge's properties according to the
2298 * segments found on its position. Basically, these are
2299 *
2300 * - the edge's main direction
2301 * - stem edge, serif edge or both (which defaults to stem then)
2302 * - rounded edge, straight or both (which defaults to straight)
2303 * - link for edge
2304 *
2305 */
2306
2307 /* first of all, set the `edge' field in each segment -- this is */
2308 /* required in order to compute edge links */
2309
2310 /*
2311 * Note that removing this loop and setting the `edge' field of each
2312 * segment directly in the code above slows down execution speed for
2313 * some reasons on platforms like the Sun.
2314 */
2315 {
2316 AF_Edge edges = axis->edges;
2317 AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges );
2318 AF_Edge edge;
2319
2320
2321 for ( edge = edges; edge < edge_limit; edge++ )
2322 {
2323 seg = edge->first;
2324 if ( seg )
2325 do
2326 {
2327 seg->edge = edge;
2328 seg = seg->edge_next;
2329
2330 } while ( seg != edge->first );
2331 }
2332
2333 /* now compute each edge properties */
2334 for ( edge = edges; edge < edge_limit; edge++ )
2335 {
2336 FT_Int is_round = 0; /* does it contain round segments? */
2337 FT_Int is_straight = 0; /* does it contain straight segments? */
|