1524 {
1534
1536
1537
1539 seg0.score = 32000;
1541
1543 segment_dir = major_dir;
1544
1545 axis->num_segments = 0;
1546
1547
1549 {
1552
1553
1555 {
1558 }
1559 }
1560 else
1561 {
1564
1565
1567 {
1570 }
1571 }
1572
1573
1574 for ( ; contour < contour_limit; contour++ )
1575 {
1578 int on_edge = 0;
1579
1580
1581
1582
1585 FT_Pos min_coord = 32000;
1586 FT_Pos max_coord = -32000;
1589 FT_Pos min_on_coord = 32000;
1590 FT_Pos max_on_coord = -32000;
1591
1593
1595
1596 FT_Pos prev_min_pos = min_pos;
1597 FT_Pos prev_max_pos = max_pos;
1598 FT_Pos prev_min_coord = min_coord;
1599 FT_Pos prev_max_coord = max_coord;
1602 FT_Pos prev_min_on_coord = min_on_coord;
1603 FT_Pos prev_max_on_coord = max_on_coord;
1604
1605
1608 {
1609
1611
1612 for (;;)
1613 {
1616 {
1618 break;
1619 }
1621 break;
1622 }
1623 }
1624
1626 passed = 0;
1627
1628 for (;;)
1629 {
1631
1632
1633 if ( on_edge )
1634 {
1635
1641
1642
1644 if (
v < min_coord )
1645 {
1647 min_flags =
point->flags;
1648 }
1649 if (
v > max_coord )
1650 {
1652 max_flags =
point->flags;
1653 }
1654
1655
1657 {
1659 if (
v < min_on_coord )
1661 if (
v > max_on_coord )
1663 }
1664
1666 {
1667
1668
1669
1670
1671 if ( !prev_segment || segment->first != prev_segment->
last )
1672 {
1673
1674
1675
1676 segment->last =
point;
1677 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1678 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1679
1680
1681
1682
1684 ( max_on_coord - min_on_coord ) < flat_threshold )
1686
1687 segment->min_coord = (
FT_Short)min_coord;
1688 segment->max_coord = (
FT_Short)max_coord;
1689 segment->height = segment->max_coord - segment->min_coord;
1690
1691 prev_segment = segment;
1692 prev_min_pos = min_pos;
1693 prev_max_pos = max_pos;
1694 prev_min_coord = min_coord;
1695 prev_max_coord = max_coord;
1696 prev_min_flags = min_flags;
1697 prev_max_flags = max_flags;
1698 prev_min_on_coord = min_on_coord;
1699 prev_max_on_coord = max_on_coord;
1700 }
1701 else
1702 {
1703
1704
1705
1707 {
1708
1709
1710
1711
1712
1713
1714
1715
1716 if ( prev_min_pos < min_pos )
1717 min_pos = prev_min_pos;
1718 if ( prev_max_pos > max_pos )
1719 max_pos = prev_max_pos;
1720
1721 if ( prev_min_coord < min_coord )
1722 {
1723 min_coord = prev_min_coord;
1724 min_flags = prev_min_flags;
1725 }
1726 if ( prev_max_coord > max_coord )
1727 {
1728 max_coord = prev_max_coord;
1729 max_flags = prev_max_flags;
1730 }
1731
1732 if ( prev_min_on_coord < min_on_coord )
1733 min_on_coord = prev_min_on_coord;
1734 if ( prev_max_on_coord > max_on_coord )
1735 max_on_coord = prev_max_on_coord;
1736
1739 max_pos ) >> 1 );
1741 min_pos ) >> 1 );
1742
1744 ( max_on_coord - min_on_coord ) < flat_threshold )
1746 else
1747 prev_segment->
flags &= ~AF_EDGE_ROUND;
1748
1753 }
1754 else
1755 {
1756
1757
1758
1759 if (
FT_ABS( prev_max_coord - prev_min_coord ) >
1760 FT_ABS( max_coord - min_coord ) )
1761 {
1762
1763
1764 if ( min_pos < prev_min_pos )
1765 prev_min_pos = min_pos;
1766 if ( max_pos > prev_max_pos )
1767 prev_max_pos = max_pos;
1768
1771 prev_max_pos ) >> 1 );
1773 prev_min_pos ) >> 1 );
1774 }
1775 else
1776 {
1777
1778
1779 if ( prev_min_pos < min_pos )
1780 min_pos = prev_min_pos;
1781 if ( prev_max_pos > max_pos )
1782 max_pos = prev_max_pos;
1783
1784 segment->last =
point;
1785 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1786 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1787
1789 ( max_on_coord - min_on_coord ) < flat_threshold )
1791
1792 segment->min_coord = (
FT_Short)min_coord;
1793 segment->max_coord = (
FT_Short)max_coord;
1794 segment->height = segment->max_coord -
1795 segment->min_coord;
1796
1797 *prev_segment = *segment;
1798
1799 prev_min_pos = min_pos;
1800 prev_max_pos = max_pos;
1801 prev_min_coord = min_coord;
1802 prev_max_coord = max_coord;
1803 prev_min_flags = min_flags;
1804 prev_max_flags = max_flags;
1805 prev_min_on_coord = min_on_coord;
1806 prev_max_on_coord = max_on_coord;
1807 }
1808 }
1809
1810 axis->num_segments--;
1811 }
1812
1813 on_edge = 0;
1815
1816
1817 }
1818 }
1819
1820
1822 {
1823 if ( passed )
1824 break;
1825 passed = 1;
1826 }
1827
1828
1829
1830
1831 if ( !on_edge &&
1834 {
1835
1837
1841
1842
1843 segment[0] = seg0;
1844
1845 segment->dir = (
FT_Char)segment_dir;
1846 segment->first =
point;
1847 segment->last =
point;
1848
1849
1850
1851 if ( prev_segment )
1852 prev_segment = segment - 1;
1853
1854 min_pos = max_pos =
point->u;
1855 min_coord = max_coord =
point->v;
1856 min_flags = max_flags =
point->flags;
1857
1859 {
1860 min_on_coord = 32000;
1861 max_on_coord = -32000;
1862 }
1863 else
1864 min_on_coord = max_on_coord =
point->v;
1865
1866 on_edge = 1;
1867
1869 {
1870
1871
1872
1874
1877
1880 segment->height = 0;
1881
1882 on_edge = 0;
1884 }
1885 }
1886
1888 }
1889
1890 }
1891
1892
1893
1894
1895 {
1897 AF_Segment segments_end = segments + axis->num_segments;
1898
1899
1900 for ( segment = segments; segment < segments_end; segment++ )
1901 {
1906
1907
1908 if ( first_v < last_v )
1909 {
1911
1912
1914 if (
p->v < first_v )
1915 segment->height = (
FT_Short)( segment->height +
1916 ( ( first_v -
p->v ) >> 1 ) );
1917
1919 if (
p->v > last_v )
1920 segment->height = (
FT_Short)( segment->height +
1921 ( (
p->v - last_v ) >> 1 ) );
1922 }
1923 else
1924 {
1926
1927
1929 if (
p->v > first_v )
1930 segment->height = (
FT_Short)( segment->height +
1931 ( (
p->v - first_v ) >> 1 ) );
1932
1934 if (
p->v < last_v )
1935 segment->height = (
FT_Short)( segment->height +
1936 ( ( last_v -
p->v ) >> 1 ) );
1937 }
1938 }
1939 }
1940
1943 }
af_axis_hints_new_segment(AF_AxisHints axis, FT_Memory memory, AF_Segment *asegment)
#define FLAT_THRESHOLD(x)
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u