1501 {
1511
1513
1514
1516 seg0.score = 32000;
1518
1520 segment_dir = major_dir;
1521
1522 axis->num_segments = 0;
1523
1524
1526 {
1529
1530
1532 {
1535 }
1536 }
1537 else
1538 {
1541
1542
1544 {
1547 }
1548 }
1549
1550
1551 for ( ; contour < contour_limit; contour++ )
1552 {
1555 int on_edge = 0;
1556
1557
1558
1559
1562 FT_Pos min_coord = 32000;
1563 FT_Pos max_coord = -32000;
1566 FT_Pos min_on_coord = 32000;
1567 FT_Pos max_on_coord = -32000;
1568
1570
1572
1573 FT_Pos prev_min_pos = min_pos;
1574 FT_Pos prev_max_pos = max_pos;
1575 FT_Pos prev_min_coord = min_coord;
1576 FT_Pos prev_max_coord = max_coord;
1579 FT_Pos prev_min_on_coord = min_on_coord;
1580 FT_Pos prev_max_on_coord = max_on_coord;
1581
1582
1585 {
1586
1588
1589 for (;;)
1590 {
1593 {
1595 break;
1596 }
1598 break;
1599 }
1600 }
1601
1603 passed = 0;
1604
1605 for (;;)
1606 {
1608
1609
1610 if ( on_edge )
1611 {
1612
1618
1619
1621 if (
v < min_coord )
1622 {
1624 min_flags =
point->flags;
1625 }
1626 if (
v > max_coord )
1627 {
1629 max_flags =
point->flags;
1630 }
1631
1632
1634 {
1636 if (
v < min_on_coord )
1638 if (
v > max_on_coord )
1640 }
1641
1643 {
1644
1645
1646
1647
1648 if ( !prev_segment || segment->first != prev_segment->
last )
1649 {
1650
1651
1652
1653 segment->last =
point;
1654 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1655 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1656
1657
1658
1659
1661 ( max_on_coord - min_on_coord ) < flat_threshold )
1663
1664 segment->min_coord = (
FT_Short)min_coord;
1665 segment->max_coord = (
FT_Short)max_coord;
1666 segment->height = segment->max_coord - segment->min_coord;
1667
1668 prev_segment = segment;
1669 prev_min_pos = min_pos;
1670 prev_max_pos = max_pos;
1671 prev_min_coord = min_coord;
1672 prev_max_coord = max_coord;
1673 prev_min_flags = min_flags;
1674 prev_max_flags = max_flags;
1675 prev_min_on_coord = min_on_coord;
1676 prev_max_on_coord = max_on_coord;
1677 }
1678 else
1679 {
1680
1681
1682
1684 {
1685
1686
1687
1688
1689
1690
1691
1692
1693 if ( prev_min_pos < min_pos )
1694 min_pos = prev_min_pos;
1695 if ( prev_max_pos > max_pos )
1696 max_pos = prev_max_pos;
1697
1698 if ( prev_min_coord < min_coord )
1699 {
1700 min_coord = prev_min_coord;
1701 min_flags = prev_min_flags;
1702 }
1703 if ( prev_max_coord > max_coord )
1704 {
1705 max_coord = prev_max_coord;
1706 max_flags = prev_max_flags;
1707 }
1708
1709 if ( prev_min_on_coord < min_on_coord )
1710 min_on_coord = prev_min_on_coord;
1711 if ( prev_max_on_coord > max_on_coord )
1712 max_on_coord = prev_max_on_coord;
1713
1716 max_pos ) >> 1 );
1718 min_pos ) >> 1 );
1719
1721 ( max_on_coord - min_on_coord ) < flat_threshold )
1723 else
1724 prev_segment->
flags &= ~AF_EDGE_ROUND;
1725
1730 }
1731 else
1732 {
1733
1734
1735
1736 if (
FT_ABS( prev_max_coord - prev_min_coord ) >
1737 FT_ABS( max_coord - min_coord ) )
1738 {
1739
1740
1741 if ( min_pos < prev_min_pos )
1742 prev_min_pos = min_pos;
1743 if ( max_pos > prev_max_pos )
1744 prev_max_pos = max_pos;
1745
1748 prev_max_pos ) >> 1 );
1750 prev_min_pos ) >> 1 );
1751 }
1752 else
1753 {
1754
1755
1756 if ( prev_min_pos < min_pos )
1757 min_pos = prev_min_pos;
1758 if ( prev_max_pos > max_pos )
1759 max_pos = prev_max_pos;
1760
1761 segment->last =
point;
1762 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1763 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1764
1766 ( max_on_coord - min_on_coord ) < flat_threshold )
1768
1769 segment->min_coord = (
FT_Short)min_coord;
1770 segment->max_coord = (
FT_Short)max_coord;
1771 segment->height = segment->max_coord -
1772 segment->min_coord;
1773
1774 *prev_segment = *segment;
1775
1776 prev_min_pos = min_pos;
1777 prev_max_pos = max_pos;
1778 prev_min_coord = min_coord;
1779 prev_max_coord = max_coord;
1780 prev_min_flags = min_flags;
1781 prev_max_flags = max_flags;
1782 prev_min_on_coord = min_on_coord;
1783 prev_max_on_coord = max_on_coord;
1784 }
1785 }
1786
1787 axis->num_segments--;
1788 }
1789
1790 on_edge = 0;
1792
1793
1794 }
1795 }
1796
1797
1799 {
1800 if ( passed )
1801 break;
1802 passed = 1;
1803 }
1804
1805
1806
1807
1808 if ( !on_edge &&
1811 {
1812
1814
1818
1819
1820 segment[0] = seg0;
1821
1822 segment->dir = (
FT_Char)segment_dir;
1823 segment->first =
point;
1824 segment->last =
point;
1825
1826
1827
1828 if ( prev_segment )
1829 prev_segment = segment - 1;
1830
1831 min_pos = max_pos =
point->u;
1832 min_coord = max_coord =
point->v;
1833 min_flags = max_flags =
point->flags;
1834
1836 {
1837 min_on_coord = 32000;
1838 max_on_coord = -32000;
1839 }
1840 else
1841 min_on_coord = max_on_coord =
point->v;
1842
1843 on_edge = 1;
1844
1846 {
1847
1848
1849
1851
1854
1857 segment->height = 0;
1858
1859 on_edge = 0;
1861 }
1862 }
1863
1865 }
1866
1867 }
1868
1869
1870
1871
1872 {
1874 AF_Segment segments_end = segments + axis->num_segments;
1875
1876
1877 for ( segment = segments; segment < segments_end; segment++ )
1878 {
1883
1884
1885 if ( first_v < last_v )
1886 {
1888
1889
1891 if (
p->v < first_v )
1892 segment->height = (
FT_Short)( segment->height +
1893 ( ( first_v -
p->v ) >> 1 ) );
1894
1896 if (
p->v > last_v )
1897 segment->height = (
FT_Short)( segment->height +
1898 ( (
p->v - last_v ) >> 1 ) );
1899 }
1900 else
1901 {
1903
1904
1906 if (
p->v > first_v )
1907 segment->height = (
FT_Short)( segment->height +
1908 ( (
p->v - first_v ) >> 1 ) );
1909
1911 if (
p->v < last_v )
1912 segment->height = (
FT_Short)( segment->height +
1913 ( ( last_v -
p->v ) >> 1 ) );
1914 }
1915 }
1916 }
1917
1920 }
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