diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 276 |
1 files changed, 105 insertions, 171 deletions
diff --git a/src/w32term.c b/src/w32term.c index a40fe2edc48..b7332ed25f9 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -59,10 +59,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 59 | #include "w32bdf.h" | 59 | #include "w32bdf.h" |
| 60 | #include <shellapi.h> | 60 | #include <shellapi.h> |
| 61 | 61 | ||
| 62 | #ifdef USE_FONT_BACKEND | ||
| 63 | #include "font.h" | 62 | #include "font.h" |
| 64 | #endif /* USE_FONT_BACKEND */ | 63 | #include "w32font.h" |
| 65 | |||
| 66 | 64 | ||
| 67 | /* Fringe bitmaps. */ | 65 | /* Fringe bitmaps. */ |
| 68 | 66 | ||
| @@ -896,6 +894,8 @@ w32_reset_terminal_modes (struct terminal *term) | |||
| 896 | 894 | ||
| 897 | /* Function prototypes of this page. */ | 895 | /* Function prototypes of this page. */ |
| 898 | 896 | ||
| 897 | #if OLD_FONT | ||
| 898 | |||
| 899 | XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int)); | 899 | XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int)); |
| 900 | static int w32_encode_char P_ ((int, wchar_t *, struct font_info *, | 900 | static int w32_encode_char P_ ((int, wchar_t *, struct font_info *, |
| 901 | struct charset *, int *)); | 901 | struct charset *, int *)); |
| @@ -1140,7 +1140,6 @@ w32_cache_char_metrics (font) | |||
| 1140 | } | 1140 | } |
| 1141 | } | 1141 | } |
| 1142 | 1142 | ||
| 1143 | |||
| 1144 | /* Determine if a font is double byte. */ | 1143 | /* Determine if a font is double byte. */ |
| 1145 | static int | 1144 | static int |
| 1146 | w32_font_is_double_byte (XFontStruct *font) | 1145 | w32_font_is_double_byte (XFontStruct *font) |
| @@ -1483,6 +1482,7 @@ w32_text_out (s, x, y,chars,nchars) | |||
| 1483 | nchars * charset_dim, NULL); | 1482 | nchars * charset_dim, NULL); |
| 1484 | } | 1483 | } |
| 1485 | 1484 | ||
| 1485 | #endif /* OLD_FONT */ | ||
| 1486 | 1486 | ||
| 1487 | static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); | 1487 | static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); |
| 1488 | static void x_set_glyph_string_gc P_ ((struct glyph_string *)); | 1488 | static void x_set_glyph_string_gc P_ ((struct glyph_string *)); |
| @@ -1594,11 +1594,6 @@ x_set_mouse_face_gc (s) | |||
| 1594 | /* If font in this face is same as S->font, use it. */ | 1594 | /* If font in this face is same as S->font, use it. */ |
| 1595 | if (s->font == s->face->font) | 1595 | if (s->font == s->face->font) |
| 1596 | s->gc = s->face->gc; | 1596 | s->gc = s->face->gc; |
| 1597 | #ifdef USE_FONT_BACKEND | ||
| 1598 | else if (enable_font_backend) | ||
| 1599 | /* No need of setting a font for s->gc. */ | ||
| 1600 | s->gc = s->face->gc; | ||
| 1601 | #endif /* USE_FONT_BACKEND */ | ||
| 1602 | else | 1597 | else |
| 1603 | { | 1598 | { |
| 1604 | /* Otherwise construct scratch_cursor_gc with values from FACE | 1599 | /* Otherwise construct scratch_cursor_gc with values from FACE |
| @@ -1692,11 +1687,7 @@ static INLINE void | |||
| 1692 | x_set_glyph_string_clipping (s) | 1687 | x_set_glyph_string_clipping (s) |
| 1693 | struct glyph_string *s; | 1688 | struct glyph_string *s; |
| 1694 | { | 1689 | { |
| 1695 | #ifdef USE_FONT_BACKEND | ||
| 1696 | RECT *r = s->clip; | 1690 | RECT *r = s->clip; |
| 1697 | #else | ||
| 1698 | RECT r[2]; | ||
| 1699 | #endif | ||
| 1700 | int n = get_glyph_string_clip_rects (s, r, 2); | 1691 | int n = get_glyph_string_clip_rects (s, r, 2); |
| 1701 | 1692 | ||
| 1702 | if (n == 1) | 1693 | if (n == 1) |
| @@ -1714,9 +1705,7 @@ x_set_glyph_string_clipping (s) | |||
| 1714 | DeleteObject (clip2); | 1705 | DeleteObject (clip2); |
| 1715 | DeleteObject (full_clip); | 1706 | DeleteObject (full_clip); |
| 1716 | } | 1707 | } |
| 1717 | #ifdef USE_FONT_BACKEND | ||
| 1718 | s->num_clips = n; | 1708 | s->num_clips = n; |
| 1719 | #endif /* USE_FONT_BACKEND */ | ||
| 1720 | } | 1709 | } |
| 1721 | 1710 | ||
| 1722 | /* Set SRC's clipping for output of glyph string DST. This is called | 1711 | /* Set SRC's clipping for output of glyph string DST. This is called |
| @@ -1729,19 +1718,14 @@ x_set_glyph_string_clipping_exactly (src, dst) | |||
| 1729 | { | 1718 | { |
| 1730 | RECT r; | 1719 | RECT r; |
| 1731 | 1720 | ||
| 1732 | #ifdef USE_FONT_BACKEND | 1721 | r.left = src->x; |
| 1733 | if (enable_font_backend) | 1722 | r.right = r.left + src->width; |
| 1734 | { | 1723 | r.top = src->y; |
| 1735 | r.left = src->x; | 1724 | r.bottom = r.top + src->height; |
| 1736 | r.right = r.left + src->width; | 1725 | dst->clip[0] = r; |
| 1737 | r.top = src->y; | 1726 | dst->num_clips = 1; |
| 1738 | r.bottom = r.top + src->height; | 1727 | #if OLD_FONT |
| 1739 | dst->clip[0] = r; | ||
| 1740 | dst->num_clips = 1; | ||
| 1741 | } | ||
| 1742 | else | ||
| 1743 | { | 1728 | { |
| 1744 | #endif /* USE_FONT_BACKEND */ | ||
| 1745 | struct glyph_string *clip_head = src->clip_head; | 1729 | struct glyph_string *clip_head = src->clip_head; |
| 1746 | struct glyph_string *clip_tail = src->clip_tail; | 1730 | struct glyph_string *clip_tail = src->clip_tail; |
| 1747 | 1731 | ||
| @@ -1749,43 +1733,33 @@ x_set_glyph_string_clipping_exactly (src, dst) | |||
| 1749 | src->clip_head = src->clip_tail = src; | 1733 | src->clip_head = src->clip_tail = src; |
| 1750 | get_glyph_string_clip_rect (src, &r); | 1734 | get_glyph_string_clip_rect (src, &r); |
| 1751 | src->clip_head = clip_head, src->clip_tail = clip_tail; | 1735 | src->clip_head = clip_head, src->clip_tail = clip_tail; |
| 1752 | #ifdef USE_FONT_BACKEND | ||
| 1753 | } | 1736 | } |
| 1754 | #endif /* USE_FONT_BACKEND */ | 1737 | #endif /* OLD_FONT */ |
| 1755 | w32_set_clip_rectangle (dst->hdc, &r); | 1738 | w32_set_clip_rectangle (dst->hdc, &r); |
| 1756 | } | 1739 | } |
| 1757 | 1740 | ||
| 1758 | /* RIF: | 1741 | /* RIF: |
| 1759 | Compute left and right overhang of glyph string S. If S is a glyph | 1742 | Compute left and right overhang of glyph string S. */ |
| 1760 | string for a composition, assume overhangs don't exist. */ | ||
| 1761 | 1743 | ||
| 1762 | static void | 1744 | static void |
| 1763 | w32_compute_glyph_string_overhangs (s) | 1745 | w32_compute_glyph_string_overhangs (s) |
| 1764 | struct glyph_string *s; | 1746 | struct glyph_string *s; |
| 1765 | { | 1747 | { |
| 1766 | if (s->cmp == NULL | 1748 | if (s->cmp == NULL |
| 1767 | && s->first_glyph->type == CHAR_GLYPH) | 1749 | && s->first_glyph->type == CHAR_GLYPH |
| 1750 | && !s->font_not_found_p) | ||
| 1768 | { | 1751 | { |
| 1769 | #ifdef USE_FONT_BACKEND | 1752 | unsigned *code = alloca (sizeof (unsigned) * s->nchars); |
| 1770 | if (enable_font_backend) | 1753 | struct font *font = s->font; |
| 1771 | { | 1754 | struct font_metrics metrics; |
| 1772 | unsigned *code = alloca (sizeof (unsigned) * s->nchars); | 1755 | int i; |
| 1773 | struct font *font = (struct font *) s->font_info; | ||
| 1774 | struct font_metrics metrics; | ||
| 1775 | int i; | ||
| 1776 | 1756 | ||
| 1777 | for (i = 0; i < s->nchars; i++) | 1757 | for (i = 0; i < s->nchars; i++) |
| 1778 | code[i] = s->char2b[i]; | 1758 | code[i] = s->char2b[i]; |
| 1779 | font->driver->text_extents (font, code, s->nchars, &metrics); | 1759 | font->driver->text_extents (font, code, s->nchars, &metrics); |
| 1780 | s->right_overhang = (metrics.rbearing > metrics.width | 1760 | s->right_overhang = (metrics.rbearing > metrics.width |
| 1781 | ? metrics.rbearing - metrics.width : 0); | 1761 | ? metrics.rbearing - metrics.width : 0); |
| 1782 | s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0; | 1762 | s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0; |
| 1783 | } | ||
| 1784 | #else | ||
| 1785 | /* TODO: Windows does not appear to have a method for | ||
| 1786 | getting this info without getting the ABC widths for each | ||
| 1787 | individual character and working it out manually. */ | ||
| 1788 | #endif | ||
| 1789 | } | 1763 | } |
| 1790 | else if (s->cmp) | 1764 | else if (s->cmp) |
| 1791 | { | 1765 | { |
| @@ -1870,7 +1844,7 @@ x_draw_glyph_string_background (s, force_p) | |||
| 1870 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width | 1844 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width |
| 1871 | || s->font_not_found_p | 1845 | || s->font_not_found_p |
| 1872 | || s->extends_to_end_of_line_p | 1846 | || s->extends_to_end_of_line_p |
| 1873 | || s->font->bdf | 1847 | || FONT_COMPAT (s->font)->bdf |
| 1874 | || cleartype_active | 1848 | || cleartype_active |
| 1875 | || force_p) | 1849 | || force_p) |
| 1876 | { | 1850 | { |
| @@ -1910,8 +1884,8 @@ x_draw_glyph_string_foreground (s) | |||
| 1910 | SetBkColor (s->hdc, s->gc->background); | 1884 | SetBkColor (s->hdc, s->gc->background); |
| 1911 | SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); | 1885 | SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); |
| 1912 | 1886 | ||
| 1913 | if (s->font && s->font->hfont) | 1887 | if (s->font && FONT_COMPAT (s->font)->hfont) |
| 1914 | old_font = SelectObject (s->hdc, s->font->hfont); | 1888 | old_font = SelectObject (s->hdc, FONT_COMPAT (s->font)->hfont); |
| 1915 | 1889 | ||
| 1916 | /* Draw characters of S as rectangles if S's font could not be | 1890 | /* Draw characters of S as rectangles if S's font could not be |
| 1917 | loaded. */ | 1891 | loaded. */ |
| @@ -1926,14 +1900,13 @@ x_draw_glyph_string_foreground (s) | |||
| 1926 | x += g->pixel_width; | 1900 | x += g->pixel_width; |
| 1927 | } | 1901 | } |
| 1928 | } | 1902 | } |
| 1929 | #ifdef USE_FONT_BACKEND | 1903 | else |
| 1930 | else if (enable_font_backend) | ||
| 1931 | { | 1904 | { |
| 1932 | int boff = s->font_info->baseline_offset; | 1905 | int boff = s->font->baseline_offset; |
| 1933 | struct font *font = (struct font *) s->font_info; | 1906 | struct font *font = s->font; |
| 1934 | int y; | 1907 | int y; |
| 1935 | 1908 | ||
| 1936 | if (s->font_info->vertical_centering) | 1909 | if (s->font->vertical_centering) |
| 1937 | boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; | 1910 | boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; |
| 1938 | 1911 | ||
| 1939 | y = s->ybase - boff; | 1912 | y = s->ybase - boff; |
| @@ -1945,34 +1918,8 @@ x_draw_glyph_string_foreground (s) | |||
| 1945 | if (s->face->overstrike) | 1918 | if (s->face->overstrike) |
| 1946 | font->driver->draw (s, 0, s->nchars, x + 1, y, 0); | 1919 | font->driver->draw (s, 0, s->nchars, x + 1, y, 0); |
| 1947 | } | 1920 | } |
| 1948 | #endif /* USE_FONT_BACKEND */ | ||
| 1949 | else | ||
| 1950 | { | ||
| 1951 | char *char1b = (char *) s->char2b; | ||
| 1952 | int boff = s->font_info->baseline_offset; | ||
| 1953 | |||
| 1954 | if (s->font_info->vertical_centering) | ||
| 1955 | boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; | ||
| 1956 | 1921 | ||
| 1957 | /* If we can use 8-bit functions, condense S->char2b. */ | 1922 | if (s->font && FONT_COMPAT (s->font)->hfont) |
| 1958 | if (!s->two_byte_p) | ||
| 1959 | for (i = 0; i < s->nchars; ++i) | ||
| 1960 | char1b[i] = XCHAR2B_BYTE2 (&s->char2b[i]); | ||
| 1961 | |||
| 1962 | /* Draw text with TextOut and friends. */ | ||
| 1963 | w32_text_out (s, x, s->ybase - boff, s->char2b, s->nchars); | ||
| 1964 | |||
| 1965 | if (s->face->overstrike) | ||
| 1966 | { | ||
| 1967 | /* For overstriking (to simulate bold-face), draw the | ||
| 1968 | characters again shifted to the right by one pixel. */ | ||
| 1969 | int old_BkMode = SetBkMode (s->hdc, TRANSPARENT); | ||
| 1970 | w32_text_out (s, x + 1, s->ybase - boff, s->char2b, s->nchars); | ||
| 1971 | if (old_BkMode && old_BkMode != TRANSPARENT) | ||
| 1972 | SetBkMode (s->hdc, old_BkMode); | ||
| 1973 | } | ||
| 1974 | } | ||
| 1975 | if (s->font && s->font->hfont) | ||
| 1976 | SelectObject (s->hdc, old_font); | 1923 | SelectObject (s->hdc, old_font); |
| 1977 | } | 1924 | } |
| 1978 | 1925 | ||
| @@ -2003,8 +1950,8 @@ x_draw_composite_glyph_string_foreground (s) | |||
| 2003 | SetBkMode (s->hdc, TRANSPARENT); | 1950 | SetBkMode (s->hdc, TRANSPARENT); |
| 2004 | SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); | 1951 | SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); |
| 2005 | 1952 | ||
| 2006 | if (s->font && s->font->hfont) | 1953 | if (s->font && FONT_COMPAT (s->font)->hfont) |
| 2007 | old_font = SelectObject (s->hdc, s->font->hfont); | 1954 | old_font = SelectObject (s->hdc, FONT_COMPAT (s->font)->hfont); |
| 2008 | 1955 | ||
| 2009 | /* Draw a rectangle for the composition if the font for the very | 1956 | /* Draw a rectangle for the composition if the font for the very |
| 2010 | first character of the composition could not be loaded. */ | 1957 | first character of the composition could not be loaded. */ |
| @@ -2014,10 +1961,9 @@ x_draw_composite_glyph_string_foreground (s) | |||
| 2014 | w32_draw_rectangle (s->hdc, s->gc, x, s->y, s->width - 1, | 1961 | w32_draw_rectangle (s->hdc, s->gc, x, s->y, s->width - 1, |
| 2015 | s->height - 1); | 1962 | s->height - 1); |
| 2016 | } | 1963 | } |
| 2017 | #ifdef USE_FONT_BACKEND | 1964 | |
| 2018 | else if (enable_font_backend) | ||
| 2019 | { | 1965 | { |
| 2020 | struct font *font = (struct font *) s->font_info; | 1966 | struct font *font = s->font; |
| 2021 | int y = s->ybase; | 1967 | int y = s->ybase; |
| 2022 | int width = 0; | 1968 | int width = 0; |
| 2023 | 1969 | ||
| @@ -2070,23 +2016,8 @@ x_draw_composite_glyph_string_foreground (s) | |||
| 2070 | } | 2016 | } |
| 2071 | } | 2017 | } |
| 2072 | } | 2018 | } |
| 2073 | #endif /* USE_FONT_BACKEND */ | ||
| 2074 | else | ||
| 2075 | { | ||
| 2076 | for (i = 0, j = s->gidx; i < s->nchars; i++, j++) | ||
| 2077 | if (s->face) | ||
| 2078 | { | ||
| 2079 | w32_text_out (s, x + s->cmp->offsets[j * 2], | ||
| 2080 | s->ybase - s->cmp->offsets[j * 2 + 1], | ||
| 2081 | s->char2b + j, 1); | ||
| 2082 | if (s->face->overstrike) | ||
| 2083 | w32_text_out (s, x + s->cmp->offsets[j * 2] + 1, | ||
| 2084 | s->ybase - s->cmp->offsets[j + 1], | ||
| 2085 | s->char2b + j, 1); | ||
| 2086 | } | ||
| 2087 | } | ||
| 2088 | 2019 | ||
| 2089 | if (s->font && s->font->hfont) | 2020 | if (s->font && FONT_COMPAT (s->font)->hfont) |
| 2090 | SelectObject (s->hdc, old_font); | 2021 | SelectObject (s->hdc, old_font); |
| 2091 | } | 2022 | } |
| 2092 | 2023 | ||
| @@ -2894,9 +2825,7 @@ x_draw_glyph_string (s) | |||
| 2894 | x_set_glyph_string_gc (next); | 2825 | x_set_glyph_string_gc (next); |
| 2895 | x_set_glyph_string_clipping (next); | 2826 | x_set_glyph_string_clipping (next); |
| 2896 | x_draw_glyph_string_background (next, 1); | 2827 | x_draw_glyph_string_background (next, 1); |
| 2897 | #ifdef USE_FONT_BACKEND | ||
| 2898 | next->num_clips = 0; | 2828 | next->num_clips = 0; |
| 2899 | #endif /* USE_FONT_BACKEND */ | ||
| 2900 | } | 2829 | } |
| 2901 | } | 2830 | } |
| 2902 | 2831 | ||
| @@ -2959,46 +2888,46 @@ x_draw_glyph_string (s) | |||
| 2959 | if (!s->for_overlaps) | 2888 | if (!s->for_overlaps) |
| 2960 | { | 2889 | { |
| 2961 | /* Draw underline. */ | 2890 | /* Draw underline. */ |
| 2962 | if (s->face->underline_p | 2891 | if (s->face->underline_p) |
| 2963 | && (s->font->bdf || !s->font->tm.tmUnderlined)) | ||
| 2964 | { | 2892 | { |
| 2965 | unsigned long h; | 2893 | unsigned long thickness, position; |
| 2966 | int y; | 2894 | int y; |
| 2967 | /* Get the underline thickness. Default is 1 pixel. */ | ||
| 2968 | #ifdef USE_FONT_BACKEND | ||
| 2969 | if (enable_font_backend) | ||
| 2970 | /* In the future, we must use information of font. */ | ||
| 2971 | h = 1; | ||
| 2972 | else | ||
| 2973 | #endif /* USE_FONT_BACKEND */ | ||
| 2974 | h = 1; | ||
| 2975 | 2895 | ||
| 2976 | #ifdef USE_FONT_BACKEND | 2896 | if (s->prev && s->prev->face->underline_p) |
| 2977 | if (enable_font_backend) | ||
| 2978 | { | ||
| 2979 | if (s->face->font) | ||
| 2980 | /* In the future, we must use information of font. */ | ||
| 2981 | y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; | ||
| 2982 | else | ||
| 2983 | y = s->y + s->height - h; | ||
| 2984 | } | ||
| 2985 | else | ||
| 2986 | #endif | ||
| 2987 | { | 2897 | { |
| 2988 | y = s->y + s->height - h; | 2898 | /* We use the same underline style as the previous one. */ |
| 2989 | /* TODO: Use font information for positioning and | 2899 | thickness = s->prev->underline_thickness; |
| 2990 | thickness of underline. See OUTLINETEXTMETRIC, | 2900 | position = s->prev->underline_position; |
| 2991 | and xterm.c. Note: If you make this work, | 2901 | } |
| 2992 | don't forget to change the doc string of | 2902 | else |
| 2993 | x-use-underline_color-position-properties | 2903 | { |
| 2994 | below. */ | 2904 | /* Get the underline thickness. Default is 1 pixel. */ |
| 2995 | #if 0 | 2905 | if (s->font && s->font->underline_thickness > 0) |
| 2996 | if (!x_underline_at_descent_line) | 2906 | thickness = s->font->underline_thickness; |
| 2907 | else | ||
| 2908 | thickness = 1; | ||
| 2909 | if (x_underline_at_descent_line) | ||
| 2910 | position = (s->height - thickness) - s->ybase; | ||
| 2911 | else | ||
| 2997 | { | 2912 | { |
| 2998 | ... | 2913 | /* Get the underline position. This is the recommended |
| 2914 | vertical offset in pixels from the baseline to the top of | ||
| 2915 | the underline. This is a signed value according to the | ||
| 2916 | specs, and its default is | ||
| 2917 | |||
| 2918 | ROUND ((maximum_descent) / 2), with | ||
| 2919 | ROUND (x) = floor (x + 0.5) */ | ||
| 2920 | |||
| 2921 | if (x_use_underline_position_properties | ||
| 2922 | && s->font && s->font->underline_position >= 0) | ||
| 2923 | position = s->font->underline_position; | ||
| 2924 | else if (s->font) | ||
| 2925 | position = (s->font->descent + 1) / 2; | ||
| 2999 | } | 2926 | } |
| 3000 | #endif | 2927 | s->underline_thickness = thickness; |
| 2928 | s->underline_position =position; | ||
| 3001 | } | 2929 | } |
| 2930 | y = s->ybase + position; | ||
| 3002 | if (s->face->underline_defaulted_p) | 2931 | if (s->face->underline_defaulted_p) |
| 3003 | { | 2932 | { |
| 3004 | w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, | 2933 | w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, |
| @@ -3029,7 +2958,8 @@ x_draw_glyph_string (s) | |||
| 3029 | 2958 | ||
| 3030 | /* Draw strike-through. */ | 2959 | /* Draw strike-through. */ |
| 3031 | if (s->face->strike_through_p | 2960 | if (s->face->strike_through_p |
| 3032 | && (s->font->bdf || !s->font->tm.tmStruckOut)) | 2961 | && (FONT_COMPAT (s->font)->bdf |
| 2962 | || !FONT_COMPAT (s->font)->tm.tmStruckOut)) | ||
| 3033 | { | 2963 | { |
| 3034 | unsigned long h = 1; | 2964 | unsigned long h = 1; |
| 3035 | unsigned long dy = (s->height - h) / 2; | 2965 | unsigned long dy = (s->height - h) / 2; |
| @@ -3071,9 +3001,7 @@ x_draw_glyph_string (s) | |||
| 3071 | x_draw_composite_glyph_string_foreground (prev); | 3001 | x_draw_composite_glyph_string_foreground (prev); |
| 3072 | w32_set_clip_rectangle (prev->hdc, NULL); | 3002 | w32_set_clip_rectangle (prev->hdc, NULL); |
| 3073 | prev->hl = save; | 3003 | prev->hl = save; |
| 3074 | #ifdef USE_FONT_BACKEND | ||
| 3075 | prev->num_clips = 0; | 3004 | prev->num_clips = 0; |
| 3076 | #endif /* USE_FONT_BACKEND */ | ||
| 3077 | } | 3005 | } |
| 3078 | } | 3006 | } |
| 3079 | 3007 | ||
| @@ -3098,18 +3026,14 @@ x_draw_glyph_string (s) | |||
| 3098 | x_draw_composite_glyph_string_foreground (next); | 3026 | x_draw_composite_glyph_string_foreground (next); |
| 3099 | w32_set_clip_rectangle (next->hdc, NULL); | 3027 | w32_set_clip_rectangle (next->hdc, NULL); |
| 3100 | next->hl = save; | 3028 | next->hl = save; |
| 3101 | #ifdef USE_FONT_BACKEND | ||
| 3102 | next->num_clips = 0; | 3029 | next->num_clips = 0; |
| 3103 | #endif /* USE_FONT_BACKEND */ | ||
| 3104 | } | 3030 | } |
| 3105 | } | 3031 | } |
| 3106 | } | 3032 | } |
| 3107 | 3033 | ||
| 3108 | /* Reset clipping. */ | 3034 | /* Reset clipping. */ |
| 3109 | w32_set_clip_rectangle (s->hdc, NULL); | 3035 | w32_set_clip_rectangle (s->hdc, NULL); |
| 3110 | #ifdef USE_FONT_BACKEND | ||
| 3111 | s->num_clips = 0; | 3036 | s->num_clips = 0; |
| 3112 | #endif /* USE_FONT_BACKEND */ | ||
| 3113 | } | 3037 | } |
| 3114 | 3038 | ||
| 3115 | 3039 | ||
| @@ -5853,6 +5777,8 @@ x_io_error_quitter (display) | |||
| 5853 | 5777 | ||
| 5854 | /* Changing the font of the frame. */ | 5778 | /* Changing the font of the frame. */ |
| 5855 | 5779 | ||
| 5780 | #if OLD_FONT | ||
| 5781 | |||
| 5856 | /* Give frame F the font named FONTNAME as its default font, and | 5782 | /* Give frame F the font named FONTNAME as its default font, and |
| 5857 | return the full name of that font. FONTNAME may be a wildcard | 5783 | return the full name of that font. FONTNAME may be a wildcard |
| 5858 | pattern; in that case, we choose some font that fits the pattern. | 5784 | pattern; in that case, we choose some font that fits the pattern. |
| @@ -5951,31 +5877,32 @@ x_new_fontset (f, fontsetname) | |||
| 5951 | 5877 | ||
| 5952 | return fontset_name (fontset); | 5878 | return fontset_name (fontset); |
| 5953 | } | 5879 | } |
| 5880 | #endif /* OLD_FONT */ | ||
| 5881 | |||
| 5954 | 5882 | ||
| 5955 | #ifdef USE_FONT_BACKEND | ||
| 5956 | Lisp_Object | 5883 | Lisp_Object |
| 5957 | x_new_fontset2 (f, fontset, font_object) | 5884 | x_new_font (f, font_object, fontset) |
| 5958 | struct frame *f; | 5885 | struct frame *f; |
| 5959 | int fontset; | ||
| 5960 | Lisp_Object font_object; | 5886 | Lisp_Object font_object; |
| 5887 | int fontset; | ||
| 5961 | { | 5888 | { |
| 5962 | struct font *font = XSAVE_VALUE (font_object)->pointer; | 5889 | struct font *font = XFONT_OBJECT (font_object); |
| 5963 | 5890 | ||
| 5964 | if (FRAME_FONT_OBJECT (f) == font) | 5891 | if (fontset < 0) |
| 5892 | fontset = fontset_from_font (font_object); | ||
| 5893 | FRAME_FONTSET (f) = fontset; | ||
| 5894 | if (FRAME_FONT (f) == font) | ||
| 5965 | /* This font is already set in frame F. There's nothing more to | 5895 | /* This font is already set in frame F. There's nothing more to |
| 5966 | do. */ | 5896 | do. */ |
| 5967 | return fontset_name (fontset); | 5897 | return fontset_name (fontset); |
| 5968 | 5898 | ||
| 5969 | BLOCK_INPUT; | 5899 | BLOCK_INPUT; |
| 5970 | 5900 | ||
| 5971 | FRAME_FONT_OBJECT (f) = font; | 5901 | FRAME_FONT (f) = font; |
| 5972 | FRAME_FONT (f) = font->font.font; | 5902 | FRAME_BASELINE_OFFSET (f) = font->baseline_offset; |
| 5973 | FRAME_BASELINE_OFFSET (f) = font->font.baseline_offset; | 5903 | FRAME_COLUMN_WIDTH (f) = font->average_width; |
| 5974 | FRAME_FONTSET (f) = fontset; | 5904 | FRAME_SPACE_WIDTH (f) = font->space_width; |
| 5975 | 5905 | FRAME_LINE_HEIGHT (f) = font->height; | |
| 5976 | FRAME_COLUMN_WIDTH (f) = font->font.average_width; | ||
| 5977 | FRAME_SPACE_WIDTH (f) = font->font.space_width; | ||
| 5978 | FRAME_LINE_HEIGHT (f) = font->font.height; | ||
| 5979 | 5906 | ||
| 5980 | compute_fringe_widths (f, 1); | 5907 | compute_fringe_widths (f, 1); |
| 5981 | 5908 | ||
| @@ -6012,7 +5939,6 @@ x_new_fontset2 (f, fontset, font_object) | |||
| 6012 | 5939 | ||
| 6013 | return fontset_name (fontset); | 5940 | return fontset_name (fontset); |
| 6014 | } | 5941 | } |
| 6015 | #endif /* USE_FONT_BACKEND */ | ||
| 6016 | 5942 | ||
| 6017 | 5943 | ||
| 6018 | /*********************************************************************** | 5944 | /*********************************************************************** |
| @@ -6569,14 +6495,11 @@ x_free_frame_resources (f) | |||
| 6569 | 6495 | ||
| 6570 | BLOCK_INPUT; | 6496 | BLOCK_INPUT; |
| 6571 | 6497 | ||
| 6572 | #ifdef USE_FONT_BACKEND | 6498 | /* We must free faces before destroying windows because some |
| 6573 | /* We must free faces before destroying windows because some | 6499 | font-driver (e.g. xft) access a window while finishing a |
| 6574 | font-driver (e.g. xft) access a window while finishing a | 6500 | face. */ |
| 6575 | face. */ | 6501 | if (FRAME_FACE_CACHE (f)) |
| 6576 | if (enable_font_backend | 6502 | free_frame_faces (f); |
| 6577 | && FRAME_FACE_CACHE (f)) | ||
| 6578 | free_frame_faces (f); | ||
| 6579 | #endif /* USE_FONT_BACKEND */ | ||
| 6580 | 6503 | ||
| 6581 | if (FRAME_W32_WINDOW (f)) | 6504 | if (FRAME_W32_WINDOW (f)) |
| 6582 | my_destroy_window (f, FRAME_W32_WINDOW (f)); | 6505 | my_destroy_window (f, FRAME_W32_WINDOW (f)); |
| @@ -6681,6 +6604,8 @@ x_wm_set_icon_position (f, icon_x, icon_y) | |||
| 6681 | Fonts | 6604 | Fonts |
| 6682 | ***********************************************************************/ | 6605 | ***********************************************************************/ |
| 6683 | 6606 | ||
| 6607 | #if OLD_FONT | ||
| 6608 | |||
| 6684 | /* The following functions are listed here to help diff stay in step | 6609 | /* The following functions are listed here to help diff stay in step |
| 6685 | with xterm.c. See w32fns.c for definitions. | 6610 | with xterm.c. See w32fns.c for definitions. |
| 6686 | 6611 | ||
| @@ -6783,6 +6708,9 @@ x_query_font (f, fontname) | |||
| 6783 | x_find_ccl_program (fontp) | 6708 | x_find_ccl_program (fontp) |
| 6784 | 6709 | ||
| 6785 | */ | 6710 | */ |
| 6711 | |||
| 6712 | #endif /* OLD_FONT */ | ||
| 6713 | |||
| 6786 | 6714 | ||
| 6787 | /*********************************************************************** | 6715 | /*********************************************************************** |
| 6788 | Initialization | 6716 | Initialization |
| @@ -6916,8 +6844,10 @@ static struct redisplay_interface w32_redisplay_interface = | |||
| 6916 | w32_draw_fringe_bitmap, | 6844 | w32_draw_fringe_bitmap, |
| 6917 | w32_define_fringe_bitmap, | 6845 | w32_define_fringe_bitmap, |
| 6918 | w32_destroy_fringe_bitmap, | 6846 | w32_destroy_fringe_bitmap, |
| 6847 | #if OLD_FONT | ||
| 6919 | w32_per_char_metric, | 6848 | w32_per_char_metric, |
| 6920 | w32_encode_char, | 6849 | w32_encode_char, |
| 6850 | #endif | ||
| 6921 | w32_compute_glyph_string_overhangs, | 6851 | w32_compute_glyph_string_overhangs, |
| 6922 | x_draw_glyph_string, | 6852 | x_draw_glyph_string, |
| 6923 | w32_define_frame_cursor, | 6853 | w32_define_frame_cursor, |
| @@ -7005,12 +6935,14 @@ x_delete_terminal (struct terminal *terminal) | |||
| 7005 | return; | 6935 | return; |
| 7006 | 6936 | ||
| 7007 | BLOCK_INPUT; | 6937 | BLOCK_INPUT; |
| 6938 | #if OLD_FONT | ||
| 7008 | /* Free the fonts in the font table. */ | 6939 | /* Free the fonts in the font table. */ |
| 7009 | for (i = 0; i < dpyinfo->n_fonts; i++) | 6940 | for (i = 0; i < dpyinfo->n_fonts; i++) |
| 7010 | if (dpyinfo->font_table[i].name) | 6941 | if (dpyinfo->font_table[i].name) |
| 7011 | { | 6942 | { |
| 7012 | DeleteObject (((XFontStruct*)(dpyinfo->font_table[i].font))->hfont); | 6943 | DeleteObject (((XFontStruct*)(dpyinfo->font_table[i].font))->hfont); |
| 7013 | } | 6944 | } |
| 6945 | #endif | ||
| 7014 | 6946 | ||
| 7015 | x_delete_display (dpyinfo); | 6947 | x_delete_display (dpyinfo); |
| 7016 | UNBLOCK_INPUT; | 6948 | UNBLOCK_INPUT; |
| @@ -7139,7 +7071,9 @@ x_delete_display (dpyinfo) | |||
| 7139 | if (dpyinfo->palette) | 7071 | if (dpyinfo->palette) |
| 7140 | DeleteObject(dpyinfo->palette); | 7072 | DeleteObject(dpyinfo->palette); |
| 7141 | } | 7073 | } |
| 7074 | #if OLD_FONT | ||
| 7142 | xfree (dpyinfo->font_table); | 7075 | xfree (dpyinfo->font_table); |
| 7076 | #endif | ||
| 7143 | xfree (dpyinfo->w32_id_name); | 7077 | xfree (dpyinfo->w32_id_name); |
| 7144 | 7078 | ||
| 7145 | w32_reset_fringes (); | 7079 | w32_reset_fringes (); |