diff options
| author | Stefan Monnier | 2010-05-08 14:47:07 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-05-08 14:47:07 -0400 |
| commit | 0235128c15aabd21b37e7a359b4932709471f156 (patch) | |
| tree | 4f32e3a638c4e3d6e7d9c232b3e0b4b939368f54 /src | |
| parent | ca63fca5b669d42d8c131a1f33446d9a9d7795f6 (diff) | |
| parent | 19ae0deb1c8c9475eb81daf7876cec5a44b5d5e0 (diff) | |
| download | emacs-0235128c15aabd21b37e7a359b4932709471f156.tar.gz emacs-0235128c15aabd21b37e7a359b4932709471f156.zip | |
Merge from emacs-23
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 28 | ||||
| -rw-r--r-- | src/composite.c | 14 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/ftfont.c | 370 | ||||
| -rw-r--r-- | src/lisp.h | 1 |
5 files changed, 412 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a3047503849..422939fce0b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,31 @@ | |||
| 1 | 2010-05-08 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * Version 23.2 released. | ||
| 4 | |||
| 5 | 2010-05-08 Andreas Schwab <schwab@linux-m68k.org> | ||
| 6 | |||
| 7 | * composite.c (autocmp_chars): Save point as marker before calling | ||
| 8 | auto-composition-function (Bug#5984). | ||
| 9 | |||
| 10 | * lisp.h (restore_point_unwind): Add prototype. | ||
| 11 | |||
| 12 | * fileio.c (restore_point_unwind): Remove static attribute. | ||
| 13 | |||
| 14 | 2010-05-08 Kenichi Handa <handa@m17n.org> | ||
| 15 | |||
| 16 | * ftfont.c (M17N_FLT_USE_NEW_FEATURE): Define it if we can use the | ||
| 17 | new feature of libotf and m17n-flt. | ||
| 18 | (ftfont_check_otf) [M17N_FLT_USE_NEW_FEATURE]: | ||
| 19 | Call OTF_check_features even if no specific feature is given. | ||
| 20 | (PACK_OTF_TAG) [M17N_FLT_USE_NEW_FEATURE]: New macro. | ||
| 21 | (ftfont_drive_otf) [M17N_FLT_USE_NEW_FEATURE]: Handle the case | ||
| 22 | that OUT is NULL. Use OTF_drive_gsub_with_log and | ||
| 23 | OTF_drive_gpos_with_log instead of OTF_drive_gsub and | ||
| 24 | OTF_drive_gpos. | ||
| 25 | (ftfont_try_otf) [M17N_FLT_USE_NEW_FEATURE]: New function. | ||
| 26 | (ftfont_shape_by_flt) [M17N_FLT_USE_NEW_FEATURE]: | ||
| 27 | Setup mflt_enable_new_feature and mflt_try_otf. | ||
| 28 | |||
| 1 | 2010-05-08 Jan Djärv <jan.h.d@swipnet.se> | 29 | 2010-05-08 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 30 | ||
| 3 | * xsettings.c (Ftool_bar_get_system_style): Correct comment. | 31 | * xsettings.c (Ftool_bar_get_system_style): Correct comment. |
diff --git a/src/composite.c b/src/composite.c index c714b403309..341eb371871 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -990,6 +990,14 @@ autocmp_chars (cft_element, charpos, bytepos, limit, win, face, string) | |||
| 990 | { | 990 | { |
| 991 | Lisp_Object args[6]; | 991 | Lisp_Object args[6]; |
| 992 | 992 | ||
| 993 | /* Save point as marker before calling out to lisp. */ | ||
| 994 | if (NILP (string)) | ||
| 995 | { | ||
| 996 | Lisp_Object m = Fmake_marker (); | ||
| 997 | set_marker_both (m, Qnil, pt, pt_byte); | ||
| 998 | record_unwind_protect (restore_point_unwind, m); | ||
| 999 | } | ||
| 1000 | |||
| 993 | args[0] = Vauto_composition_function; | 1001 | args[0] = Vauto_composition_function; |
| 994 | args[1] = AREF (elt, 2); | 1002 | args[1] = AREF (elt, 2); |
| 995 | args[2] = pos; | 1003 | args[2] = pos; |
| @@ -998,8 +1006,10 @@ autocmp_chars (cft_element, charpos, bytepos, limit, win, face, string) | |||
| 998 | args[5] = string; | 1006 | args[5] = string; |
| 999 | gstring = safe_call (6, args); | 1007 | gstring = safe_call (6, args); |
| 1000 | } | 1008 | } |
| 1001 | if (NILP (string)) | 1009 | else if (NILP (string)) |
| 1002 | TEMP_SET_PT_BOTH (pt, pt_byte); | 1010 | { |
| 1011 | TEMP_SET_PT_BOTH (pt, pt_byte); | ||
| 1012 | } | ||
| 1003 | return unbind_to (count, gstring); | 1013 | return unbind_to (count, gstring); |
| 1004 | } | 1014 | } |
| 1005 | } | 1015 | } |
diff --git a/src/fileio.c b/src/fileio.c index 6e9ab6f2a1e..85685ebc9c4 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -299,7 +299,7 @@ close_file_unwind (fd) | |||
| 299 | 299 | ||
| 300 | /* Restore point, having saved it as a marker. */ | 300 | /* Restore point, having saved it as a marker. */ |
| 301 | 301 | ||
| 302 | static Lisp_Object | 302 | Lisp_Object |
| 303 | restore_point_unwind (location) | 303 | restore_point_unwind (location) |
| 304 | Lisp_Object location; | 304 | Lisp_Object location; |
| 305 | { | 305 | { |
diff --git a/src/ftfont.c b/src/ftfont.c index f4fe5b8e5c0..6956c134a7c 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -1578,6 +1578,14 @@ ftfont_otf_capability (font) | |||
| 1578 | 1578 | ||
| 1579 | #ifdef HAVE_M17N_FLT | 1579 | #ifdef HAVE_M17N_FLT |
| 1580 | 1580 | ||
| 1581 | #if ((LIBOTF_MAJOR_VERSION > 1) || (LIBOTF_RELEASE_NUMBER >= 10) \ | ||
| 1582 | && (M17NLIB_MAJOR_VERSION > 1) || (M17NLIB_MINOR_VERSION >= 6)) | ||
| 1583 | /* We can use the new feature of libotf and m17n-flt to handle the | ||
| 1584 | character encoding scheme introduced in Unicode 5.1 and 5.2 for | ||
| 1585 | some Agian scripts. */ | ||
| 1586 | #define M17N_FLT_USE_NEW_FEATURE | ||
| 1587 | #endif | ||
| 1588 | |||
| 1581 | struct MFLTFontFT | 1589 | struct MFLTFontFT |
| 1582 | { | 1590 | { |
| 1583 | MFLTFont flt_font; | 1591 | MFLTFont flt_font; |
| @@ -1696,10 +1704,16 @@ ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec) | |||
| 1696 | else | 1704 | else |
| 1697 | tags[n] = spec->features[i][n]; | 1705 | tags[n] = spec->features[i][n]; |
| 1698 | } | 1706 | } |
| 1707 | #ifdef M17N_FLT_USE_NEW_FEATURE | ||
| 1708 | if (OTF_check_features (otf, i == 0, spec->script, spec->langsys, | ||
| 1709 | tags, n - negative) != 1) | ||
| 1710 | return 0; | ||
| 1711 | #else /* not M17N_FLT_USE_NEW_FEATURE */ | ||
| 1699 | if (n - negative > 0 | 1712 | if (n - negative > 0 |
| 1700 | && OTF_check_features (otf, i == 0, spec->script, spec->langsys, | 1713 | && OTF_check_features (otf, i == 0, spec->script, spec->langsys, |
| 1701 | tags, n - negative) != 1) | 1714 | tags, n - negative) != 1) |
| 1702 | return 0; | 1715 | return 0; |
| 1716 | #endif /* not M17N_FLT_USE_NEW_FEATURE */ | ||
| 1703 | } | 1717 | } |
| 1704 | return 1; | 1718 | return 1; |
| 1705 | } | 1719 | } |
| @@ -1757,6 +1771,356 @@ setup_otf_gstring (int size) | |||
| 1757 | memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * size); | 1771 | memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * size); |
| 1758 | } | 1772 | } |
| 1759 | 1773 | ||
| 1774 | #ifdef M17N_FLT_USE_NEW_FEATURE | ||
| 1775 | |||
| 1776 | /* Pack 32-bit OTF tag (0x7F7F7F7F) into 28-bit (0x0FFFFFFF). */ | ||
| 1777 | #define PACK_OTF_TAG(TAG) \ | ||
| 1778 | ((((TAG) & 0x7F000000) >> 3) \ | ||
| 1779 | | (((TAG) & 0x7F0000) >> 2) \ | ||
| 1780 | | (((TAG) & 0x7F00) >> 1) \ | ||
| 1781 | | ((TAG) & 0x7F)) | ||
| 1782 | |||
| 1783 | /* Assuming that FONT is an OpenType font, apply OpenType features | ||
| 1784 | specified in SPEC on glyphs between FROM and TO of IN, and record | ||
| 1785 | the lastly applied feature in each glyph of IN. If OUT is not | ||
| 1786 | NULL, append the resulting glyphs to OUT while storing glyph | ||
| 1787 | position adjustment information in ADJUSTMENT. */ | ||
| 1788 | |||
| 1789 | static int | ||
| 1790 | ftfont_drive_otf (font, spec, in, from, to, out, adjustment) | ||
| 1791 | MFLTFont *font; | ||
| 1792 | MFLTOtfSpec *spec; | ||
| 1793 | MFLTGlyphString *in; | ||
| 1794 | int from, to; | ||
| 1795 | MFLTGlyphString *out; | ||
| 1796 | MFLTGlyphAdjustment *adjustment; | ||
| 1797 | { | ||
| 1798 | struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; | ||
| 1799 | FT_Face ft_face = flt_font_ft->ft_face; | ||
| 1800 | OTF *otf = flt_font_ft->otf; | ||
| 1801 | int len = to - from; | ||
| 1802 | int i, j, gidx; | ||
| 1803 | OTF_Glyph *otfg; | ||
| 1804 | char script[5], *langsys = NULL; | ||
| 1805 | char *gsub_features = NULL, *gpos_features = NULL; | ||
| 1806 | OTF_Feature *features; | ||
| 1807 | |||
| 1808 | if (len == 0) | ||
| 1809 | return from; | ||
| 1810 | OTF_tag_name (spec->script, script); | ||
| 1811 | if (spec->langsys) | ||
| 1812 | { | ||
| 1813 | langsys = alloca (5); | ||
| 1814 | OTF_tag_name (spec->langsys, langsys); | ||
| 1815 | } | ||
| 1816 | for (i = 0; i < 2; i++) | ||
| 1817 | { | ||
| 1818 | char *p; | ||
| 1819 | |||
| 1820 | if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF) | ||
| 1821 | { | ||
| 1822 | for (j = 0; spec->features[i][j]; j++); | ||
| 1823 | if (i == 0) | ||
| 1824 | p = gsub_features = alloca (6 * j); | ||
| 1825 | else | ||
| 1826 | p = gpos_features = alloca (6 * j); | ||
| 1827 | for (j = 0; spec->features[i][j]; j++) | ||
| 1828 | { | ||
| 1829 | if (spec->features[i][j] == 0xFFFFFFFF) | ||
| 1830 | *p++ = '*', *p++ = ','; | ||
| 1831 | else | ||
| 1832 | { | ||
| 1833 | OTF_tag_name (spec->features[i][j], p); | ||
| 1834 | p[4] = ','; | ||
| 1835 | p += 5; | ||
| 1836 | } | ||
| 1837 | } | ||
| 1838 | *--p = '\0'; | ||
| 1839 | } | ||
| 1840 | } | ||
| 1841 | |||
| 1842 | setup_otf_gstring (len); | ||
| 1843 | for (i = 0; i < len; i++) | ||
| 1844 | { | ||
| 1845 | otf_gstring.glyphs[i].c = in->glyphs[from + i].c; | ||
| 1846 | otf_gstring.glyphs[i].glyph_id = in->glyphs[from + i].code; | ||
| 1847 | } | ||
| 1848 | |||
| 1849 | OTF_drive_gdef (otf, &otf_gstring); | ||
| 1850 | gidx = out ? out->used : from; | ||
| 1851 | |||
| 1852 | if (gsub_features && out) | ||
| 1853 | { | ||
| 1854 | if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys, | ||
| 1855 | gsub_features) < 0) | ||
| 1856 | goto simple_copy; | ||
| 1857 | if (out->allocated < out->used + otf_gstring.used) | ||
| 1858 | return -2; | ||
| 1859 | features = otf->gsub->FeatureList.Feature; | ||
| 1860 | for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; ) | ||
| 1861 | { | ||
| 1862 | MFLTGlyph *g; | ||
| 1863 | int min_from, max_to; | ||
| 1864 | int j; | ||
| 1865 | int feature_idx = otfg->positioning_type >> 4; | ||
| 1866 | |||
| 1867 | g = out->glyphs + out->used; | ||
| 1868 | *g = in->glyphs[from + otfg->f.index.from]; | ||
| 1869 | if (g->code != otfg->glyph_id) | ||
| 1870 | { | ||
| 1871 | g->c = 0; | ||
| 1872 | g->code = otfg->glyph_id; | ||
| 1873 | g->measured = 0; | ||
| 1874 | } | ||
| 1875 | out->used++; | ||
| 1876 | min_from = g->from; | ||
| 1877 | max_to = g->to; | ||
| 1878 | if (otfg->f.index.from < otfg->f.index.to) | ||
| 1879 | { | ||
| 1880 | /* OTFG substitutes multiple glyphs in IN. */ | ||
| 1881 | for (j = from + otfg->f.index.from + 1; | ||
| 1882 | j <= from + otfg->f.index.to; j++) | ||
| 1883 | { | ||
| 1884 | if (min_from > in->glyphs[j].from) | ||
| 1885 | min_from = in->glyphs[j].from; | ||
| 1886 | if (max_to < in->glyphs[j].to) | ||
| 1887 | max_to = in->glyphs[j].to; | ||
| 1888 | } | ||
| 1889 | g->from = min_from; | ||
| 1890 | g->to = max_to; | ||
| 1891 | } | ||
| 1892 | if (feature_idx) | ||
| 1893 | { | ||
| 1894 | unsigned int tag = features[feature_idx - 1].FeatureTag; | ||
| 1895 | tag = PACK_OTF_TAG (tag); | ||
| 1896 | g->internal = (g->internal & ~0x1FFFFFFF) | tag; | ||
| 1897 | } | ||
| 1898 | for (i++, otfg++; (i < otf_gstring.used | ||
| 1899 | && otfg->f.index.from == otfg[-1].f.index.from); | ||
| 1900 | i++, otfg++) | ||
| 1901 | { | ||
| 1902 | g = out->glyphs + out->used; | ||
| 1903 | *g = in->glyphs[from + otfg->f.index.to]; | ||
| 1904 | if (g->code != otfg->glyph_id) | ||
| 1905 | { | ||
| 1906 | g->c = 0; | ||
| 1907 | g->code = otfg->glyph_id; | ||
| 1908 | g->measured = 0; | ||
| 1909 | } | ||
| 1910 | feature_idx = otfg->positioning_type >> 4; | ||
| 1911 | if (feature_idx) | ||
| 1912 | { | ||
| 1913 | unsigned int tag = features[feature_idx - 1].FeatureTag; | ||
| 1914 | tag = PACK_OTF_TAG (tag); | ||
| 1915 | g->internal = (g->internal & ~0x1FFFFFFF) | tag; | ||
| 1916 | } | ||
| 1917 | out->used++; | ||
| 1918 | } | ||
| 1919 | } | ||
| 1920 | } | ||
| 1921 | else if (gsub_features) | ||
| 1922 | { | ||
| 1923 | /* Just for checking which features will be applied. */ | ||
| 1924 | if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys, | ||
| 1925 | gsub_features) < 0) | ||
| 1926 | goto simple_copy; | ||
| 1927 | features = otf->gsub->FeatureList.Feature; | ||
| 1928 | for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, | ||
| 1929 | otfg++) | ||
| 1930 | { | ||
| 1931 | int feature_idx = otfg->positioning_type >> 4; | ||
| 1932 | |||
| 1933 | if (feature_idx) | ||
| 1934 | { | ||
| 1935 | unsigned int tag = features[feature_idx - 1].FeatureTag; | ||
| 1936 | tag = PACK_OTF_TAG (tag); | ||
| 1937 | for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) | ||
| 1938 | { | ||
| 1939 | MFLTGlyph *g = in->glyphs + (from + j); | ||
| 1940 | g->internal = (g->internal & ~0x1FFFFFFF) | tag; | ||
| 1941 | } | ||
| 1942 | } | ||
| 1943 | } | ||
| 1944 | } | ||
| 1945 | else if (out) | ||
| 1946 | { | ||
| 1947 | if (out->allocated < out->used + len) | ||
| 1948 | return -2; | ||
| 1949 | for (i = 0; i < len; i++) | ||
| 1950 | out->glyphs[out->used++] = in->glyphs[from + i]; | ||
| 1951 | } | ||
| 1952 | |||
| 1953 | if (gpos_features && out) | ||
| 1954 | { | ||
| 1955 | MFLTGlyph *base = NULL, *mark = NULL, *g; | ||
| 1956 | int x_ppem, y_ppem, x_scale, y_scale; | ||
| 1957 | |||
| 1958 | if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys, | ||
| 1959 | gpos_features) < 0) | ||
| 1960 | return to; | ||
| 1961 | features = otf->gpos->FeatureList.Feature; | ||
| 1962 | x_ppem = ft_face->size->metrics.x_ppem; | ||
| 1963 | y_ppem = ft_face->size->metrics.y_ppem; | ||
| 1964 | x_scale = ft_face->size->metrics.x_scale; | ||
| 1965 | y_scale = ft_face->size->metrics.y_scale; | ||
| 1966 | |||
| 1967 | for (i = 0, otfg = otf_gstring.glyphs, g = out->glyphs + gidx; | ||
| 1968 | i < otf_gstring.used; i++, otfg++, g++) | ||
| 1969 | { | ||
| 1970 | MFLTGlyph *prev; | ||
| 1971 | int feature_idx = otfg->positioning_type >> 4; | ||
| 1972 | |||
| 1973 | if (feature_idx) | ||
| 1974 | { | ||
| 1975 | unsigned int tag = features[feature_idx - 1].FeatureTag; | ||
| 1976 | tag = PACK_OTF_TAG (tag); | ||
| 1977 | g->internal = (g->internal & ~0x1FFFFFFF) | tag; | ||
| 1978 | } | ||
| 1979 | |||
| 1980 | if (! otfg->glyph_id) | ||
| 1981 | continue; | ||
| 1982 | switch (otfg->positioning_type & 0xF) | ||
| 1983 | { | ||
| 1984 | case 0: | ||
| 1985 | break; | ||
| 1986 | case 1: /* Single */ | ||
| 1987 | case 2: /* Pair */ | ||
| 1988 | { | ||
| 1989 | int format = otfg->f.f1.format; | ||
| 1990 | |||
| 1991 | if (format & OTF_XPlacement) | ||
| 1992 | adjustment[i].xoff | ||
| 1993 | = otfg->f.f1.value->XPlacement * x_scale / 0x10000; | ||
| 1994 | if (format & OTF_XPlaDevice) | ||
| 1995 | adjustment[i].xoff | ||
| 1996 | += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem); | ||
| 1997 | if (format & OTF_YPlacement) | ||
| 1998 | adjustment[i].yoff | ||
| 1999 | = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000); | ||
| 2000 | if (format & OTF_YPlaDevice) | ||
| 2001 | adjustment[i].yoff | ||
| 2002 | -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem); | ||
| 2003 | if (format & OTF_XAdvance) | ||
| 2004 | adjustment[i].xadv | ||
| 2005 | += otfg->f.f1.value->XAdvance * x_scale / 0x10000; | ||
| 2006 | if (format & OTF_XAdvDevice) | ||
| 2007 | adjustment[i].xadv | ||
| 2008 | += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem); | ||
| 2009 | if (format & OTF_YAdvance) | ||
| 2010 | adjustment[i].yadv | ||
| 2011 | += otfg->f.f1.value->YAdvance * y_scale / 0x10000; | ||
| 2012 | if (format & OTF_YAdvDevice) | ||
| 2013 | adjustment[i].yadv | ||
| 2014 | += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem); | ||
| 2015 | adjustment[i].set = 1; | ||
| 2016 | } | ||
| 2017 | break; | ||
| 2018 | case 3: /* Cursive */ | ||
| 2019 | /* Not yet supported. */ | ||
| 2020 | break; | ||
| 2021 | case 4: /* Mark-to-Base */ | ||
| 2022 | case 5: /* Mark-to-Ligature */ | ||
| 2023 | if (! base) | ||
| 2024 | break; | ||
| 2025 | prev = base; | ||
| 2026 | goto label_adjust_anchor; | ||
| 2027 | default: /* i.e. case 6 Mark-to-Mark */ | ||
| 2028 | if (! mark) | ||
| 2029 | break; | ||
| 2030 | prev = mark; | ||
| 2031 | |||
| 2032 | label_adjust_anchor: | ||
| 2033 | { | ||
| 2034 | int base_x, base_y, mark_x, mark_y; | ||
| 2035 | int this_from, this_to; | ||
| 2036 | |||
| 2037 | base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000; | ||
| 2038 | base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000; | ||
| 2039 | mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000; | ||
| 2040 | mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000; | ||
| 2041 | |||
| 2042 | if (otfg->f.f4.base_anchor->AnchorFormat != 1) | ||
| 2043 | adjust_anchor (ft_face, otfg->f.f4.base_anchor, | ||
| 2044 | prev->code, x_ppem, y_ppem, &base_x, &base_y); | ||
| 2045 | if (otfg->f.f4.mark_anchor->AnchorFormat != 1) | ||
| 2046 | adjust_anchor (ft_face, otfg->f.f4.mark_anchor, g->code, | ||
| 2047 | x_ppem, y_ppem, &mark_x, &mark_y); | ||
| 2048 | adjustment[i].xoff = (base_x - mark_x); | ||
| 2049 | adjustment[i].yoff = - (base_y - mark_y); | ||
| 2050 | adjustment[i].back = (g - prev); | ||
| 2051 | adjustment[i].xadv = 0; | ||
| 2052 | adjustment[i].advance_is_absolute = 1; | ||
| 2053 | adjustment[i].set = 1; | ||
| 2054 | this_from = g->from; | ||
| 2055 | this_to = g->to; | ||
| 2056 | for (j = 0; prev + j < g; j++) | ||
| 2057 | { | ||
| 2058 | if (this_from > prev[j].from) | ||
| 2059 | this_from = prev[j].from; | ||
| 2060 | if (this_to < prev[j].to) | ||
| 2061 | this_to = prev[j].to; | ||
| 2062 | } | ||
| 2063 | for (; prev <= g; prev++) | ||
| 2064 | { | ||
| 2065 | prev->from = this_from; | ||
| 2066 | prev->to = this_to; | ||
| 2067 | } | ||
| 2068 | } | ||
| 2069 | } | ||
| 2070 | if (otfg->GlyphClass == OTF_GlyphClass0) | ||
| 2071 | base = mark = g; | ||
| 2072 | else if (otfg->GlyphClass == OTF_GlyphClassMark) | ||
| 2073 | mark = g; | ||
| 2074 | else | ||
| 2075 | base = g; | ||
| 2076 | } | ||
| 2077 | } | ||
| 2078 | else if (gpos_features) | ||
| 2079 | { | ||
| 2080 | if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys, | ||
| 2081 | gpos_features) < 0) | ||
| 2082 | return to; | ||
| 2083 | features = otf->gpos->FeatureList.Feature; | ||
| 2084 | for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; | ||
| 2085 | i++, otfg++) | ||
| 2086 | if (otfg->positioning_type & 0xF) | ||
| 2087 | { | ||
| 2088 | int feature_idx = otfg->positioning_type >> 4; | ||
| 2089 | |||
| 2090 | if (feature_idx) | ||
| 2091 | { | ||
| 2092 | unsigned int tag = features[feature_idx - 1].FeatureTag; | ||
| 2093 | tag = PACK_OTF_TAG (tag); | ||
| 2094 | for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) | ||
| 2095 | { | ||
| 2096 | MFLTGlyph *g = in->glyphs + (from + j); | ||
| 2097 | g->internal = (g->internal & ~0x1FFFFFFF) | tag; | ||
| 2098 | } | ||
| 2099 | } | ||
| 2100 | } | ||
| 2101 | } | ||
| 2102 | return to; | ||
| 2103 | |||
| 2104 | simple_copy: | ||
| 2105 | if (! out) | ||
| 2106 | return to; | ||
| 2107 | if (out->allocated < out->used + len) | ||
| 2108 | return -2; | ||
| 2109 | font->get_metrics (font, in, from, to); | ||
| 2110 | memcpy (out->glyphs + out->used, in->glyphs + from, | ||
| 2111 | sizeof (MFLTGlyph) * len); | ||
| 2112 | out->used += len; | ||
| 2113 | return to; | ||
| 2114 | } | ||
| 2115 | |||
| 2116 | static int | ||
| 2117 | ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec, | ||
| 2118 | MFLTGlyphString *in, int from, int to) | ||
| 2119 | { | ||
| 2120 | return ftfont_drive_otf (font, spec, in, from, to, NULL, NULL); | ||
| 2121 | } | ||
| 2122 | |||
| 2123 | #else /* not M17N_FLT_USE_NEW_FEATURE */ | ||
| 1760 | 2124 | ||
| 1761 | static int | 2125 | static int |
| 1762 | ftfont_drive_otf (font, spec, in, from, to, out, adjustment) | 2126 | ftfont_drive_otf (font, spec, in, from, to, out, adjustment) |
| @@ -2011,6 +2375,8 @@ ftfont_drive_otf (font, spec, in, from, to, out, adjustment) | |||
| 2011 | return to; | 2375 | return to; |
| 2012 | } | 2376 | } |
| 2013 | 2377 | ||
| 2378 | #endif /* not M17N_FLT_USE_NEW_FEATURE */ | ||
| 2379 | |||
| 2014 | static MFLTGlyphString gstring; | 2380 | static MFLTGlyphString gstring; |
| 2015 | 2381 | ||
| 2016 | static int m17n_flt_initialized; | 2382 | static int m17n_flt_initialized; |
| @@ -2034,6 +2400,10 @@ ftfont_shape_by_flt (lgstring, font, ft_face, otf, matrix) | |||
| 2034 | if (! m17n_flt_initialized) | 2400 | if (! m17n_flt_initialized) |
| 2035 | { | 2401 | { |
| 2036 | M17N_INIT (); | 2402 | M17N_INIT (); |
| 2403 | #ifdef M17N_FLT_USE_NEW_FEATURE | ||
| 2404 | mflt_enable_new_feature = 1; | ||
| 2405 | mflt_try_otf = ftfont_try_otf; | ||
| 2406 | #endif /* M17N_FLT_USE_NEW_FEATURE */ | ||
| 2037 | m17n_flt_initialized = 1; | 2407 | m17n_flt_initialized = 1; |
| 2038 | } | 2408 | } |
| 2039 | 2409 | ||
diff --git a/src/lisp.h b/src/lisp.h index 5b59c3e9a34..7d329cc754c 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3059,6 +3059,7 @@ EXFUN (Ffile_readable_p, 1); | |||
| 3059 | EXFUN (Ffile_executable_p, 1); | 3059 | EXFUN (Ffile_executable_p, 1); |
| 3060 | EXFUN (Fread_file_name, 6); | 3060 | EXFUN (Fread_file_name, 6); |
| 3061 | extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); | 3061 | extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); |
| 3062 | extern Lisp_Object restore_point_unwind P_ ((Lisp_Object)); | ||
| 3062 | extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN; | 3063 | extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN; |
| 3063 | extern int internal_delete_file P_ ((Lisp_Object, Lisp_Object)); | 3064 | extern int internal_delete_file P_ ((Lisp_Object, Lisp_Object)); |
| 3064 | extern void syms_of_fileio P_ ((void)); | 3065 | extern void syms_of_fileio P_ ((void)); |