Mercurial > emacs
comparison src/w32term.c @ 94912:5b153bea483d
: Throughout the file, delete all USE_FONT_BACKEND
conditionals. Don't check enable_font_backend. Delete all codes
used only when USE_FONT_BACKEND is not defined. Surround non-used
code by "#ifdef OLD_FONT" and "endif".
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 14 May 2008 00:40:04 +0000 |
parents | 7e2e9d86af3b |
children | 8971ddf55736 |
comparison
equal
deleted
inserted
replaced
94911:f29483946da4 | 94912:5b153bea483d |
---|---|
57 | 57 |
58 #include "w32heap.h" | 58 #include "w32heap.h" |
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 |
69 static int max_fringe_bmp = 0; | 67 static int max_fringe_bmp = 0; |
70 static HBITMAP *fringe_bmp = 0; | 68 static HBITMAP *fringe_bmp = 0; |
894 Display Iterator | 892 Display Iterator |
895 ***********************************************************************/ | 893 ***********************************************************************/ |
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 *)); |
902 | 902 |
903 | 903 |
1137 else | 1137 else |
1138 w32_native_per_char_metric (font, &char2b, ANSI_FONT, | 1138 w32_native_per_char_metric (font, &char2b, ANSI_FONT, |
1139 &font->max_bounds); | 1139 &font->max_bounds); |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | |
1143 | 1142 |
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) |
1147 { | 1146 { |
1481 else | 1480 else |
1482 ExtTextOutA (s->hdc, x, y, 0, NULL, (char *) chars, | 1481 ExtTextOutA (s->hdc, x, y, 0, NULL, (char *) chars, |
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 *)); |
1489 static void x_draw_glyph_string_background P_ ((struct glyph_string *, | 1489 static void x_draw_glyph_string_background P_ ((struct glyph_string *, |
1490 int)); | 1490 int)); |
1592 PREPARE_FACE_FOR_DISPLAY (s->f, s->face); | 1592 PREPARE_FACE_FOR_DISPLAY (s->f, s->face); |
1593 | 1593 |
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 |
1605 but font FONT. */ | 1600 but font FONT. */ |
1606 XGCValues xgcv; | 1601 XGCValues xgcv; |
1690 | 1685 |
1691 static INLINE void | 1686 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) |
1703 w32_set_clip_rectangle (s->hdc, r); | 1694 w32_set_clip_rectangle (s->hdc, r); |
1704 else if (n > 1) | 1695 else if (n > 1) |
1712 } | 1703 } |
1713 DeleteObject (clip1); | 1704 DeleteObject (clip1); |
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 |
1723 when we are drawing DST's left_overhang or right_overhang only in | 1712 when we are drawing DST's left_overhang or right_overhang only in |
1724 the area of SRC. */ | 1713 the area of SRC. */ |
1727 x_set_glyph_string_clipping_exactly (src, dst) | 1716 x_set_glyph_string_clipping_exactly (src, dst) |
1728 struct glyph_string *src, *dst; | 1717 struct glyph_string *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; | 1728 { |
1740 dst->num_clips = 1; | |
1741 } | |
1742 else | |
1743 { | |
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 |
1748 /* This foces clipping just this glyph string. */ | 1732 /* This foces clipping just this glyph string. */ |
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 | 1736 } |
1753 } | 1737 #endif /* OLD_FONT */ |
1754 #endif /* USE_FONT_BACKEND */ | |
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 |
1768 { | 1750 && !s->font_not_found_p) |
1769 #ifdef USE_FONT_BACKEND | 1751 { |
1770 if (enable_font_backend) | 1752 unsigned *code = alloca (sizeof (unsigned) * s->nchars); |
1771 { | 1753 struct font *font = s->font; |
1772 unsigned *code = alloca (sizeof (unsigned) * s->nchars); | 1754 struct font_metrics metrics; |
1773 struct font *font = (struct font *) s->font_info; | 1755 int i; |
1774 struct font_metrics metrics; | 1756 |
1775 int i; | 1757 for (i = 0; i < s->nchars; i++) |
1776 | 1758 code[i] = s->char2b[i]; |
1777 for (i = 0; i < s->nchars; i++) | 1759 font->driver->text_extents (font, code, s->nchars, &metrics); |
1778 code[i] = s->char2b[i]; | 1760 s->right_overhang = (metrics.rbearing > metrics.width |
1779 font->driver->text_extents (font, code, s->nchars, &metrics); | 1761 ? metrics.rbearing - metrics.width : 0); |
1780 s->right_overhang = (metrics.rbearing > metrics.width | 1762 s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0; |
1781 ? metrics.rbearing - metrics.width : 0); | |
1782 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 { |
1792 s->right_overhang = s->cmp->rbearing - s->cmp->pixel_width; | 1766 s->right_overhang = s->cmp->rbearing - s->cmp->pixel_width; |
1793 s->left_overhang = -s->cmp->lbearing; | 1767 s->left_overhang = -s->cmp->lbearing; |
1868 else | 1842 else |
1869 #endif | 1843 #endif |
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 { |
1877 x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, | 1851 x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, |
1878 s->background_width, | 1852 s->background_width, |
1908 | 1882 |
1909 SetTextColor (s->hdc, s->gc->foreground); | 1883 SetTextColor (s->hdc, s->gc->foreground); |
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. */ |
1918 if (s->font_not_found_p) | 1892 if (s->font_not_found_p) |
1919 { | 1893 { |
1924 w32_draw_rectangle (s->hdc, s->gc, x, s->y, g->pixel_width - 1, | 1898 w32_draw_rectangle (s->hdc, s->gc, x, s->y, g->pixel_width - 1, |
1925 s->height - 1); | 1899 s->height - 1); |
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) | 1904 { |
1931 { | 1905 int boff = s->font->baseline_offset; |
1932 int boff = s->font_info->baseline_offset; | 1906 struct font *font = s->font; |
1933 struct font *font = (struct font *) s->font_info; | |
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; |
1940 if (s->for_overlaps | 1913 if (s->for_overlaps |
1941 || (s->background_filled_p && s->hl != DRAW_CURSOR)) | 1914 || (s->background_filled_p && s->hl != DRAW_CURSOR)) |
1943 else | 1916 else |
1944 font->driver->draw (s, 0, s->nchars, x, y, 1); | 1917 font->driver->draw (s, 0, s->nchars, x, y, 1); |
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 */ | 1921 |
1949 else | 1922 if (s->font && FONT_COMPAT (s->font)->hfont) |
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 | |
1957 /* If we can use 8-bit functions, condense S->char2b. */ | |
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 |
1979 /* Draw the foreground of composite glyph string S. */ | 1926 /* Draw the foreground of composite glyph string S. */ |
1980 | 1927 |
2001 SetTextColor (s->hdc, s->gc->foreground); | 1948 SetTextColor (s->hdc, s->gc->foreground); |
2002 SetBkColor (s->hdc, s->gc->background); | 1949 SetBkColor (s->hdc, s->gc->background); |
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. */ |
2011 if (s->font_not_found_p) | 1958 if (s->font_not_found_p) |
2012 { | 1959 { |
2013 if (s->gidx == 0) | 1960 if (s->gidx == 0) |
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) | 1965 { |
2019 { | 1966 struct font *font = s->font; |
2020 struct font *font = (struct font *) s->font_info; | |
2021 int y = s->ybase; | 1967 int y = s->ybase; |
2022 int width = 0; | 1968 int width = 0; |
2023 | 1969 |
2024 if (s->cmp->method == COMPOSITION_WITH_GLYPH_STRING) | 1970 if (s->cmp->method == COMPOSITION_WITH_GLYPH_STRING) |
2025 { | 1971 { |
2068 if (s->face->overstrike) | 2014 if (s->face->overstrike) |
2069 font->driver->draw (s, j, j + 1, xx + 1, yy, 0); | 2015 font->driver->draw (s, j, j + 1, xx + 1, yy, 0); |
2070 } | 2016 } |
2071 } | 2017 } |
2072 } | 2018 } |
2073 #endif /* USE_FONT_BACKEND */ | 2019 |
2074 else | 2020 if (s->font && FONT_COMPAT (s->font)->hfont) |
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 | |
2089 if (s->font && s->font->hfont) | |
2090 SelectObject (s->hdc, old_font); | 2021 SelectObject (s->hdc, old_font); |
2091 } | 2022 } |
2092 | 2023 |
2093 | 2024 |
2094 /* Brightness beyond which a color won't have its highlight brightness | 2025 /* Brightness beyond which a color won't have its highlight brightness |
2892 if (next->first_glyph->type != IMAGE_GLYPH) | 2823 if (next->first_glyph->type != IMAGE_GLYPH) |
2893 { | 2824 { |
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 |
2903 /* Set up S->gc, set clipping and draw S. */ | 2832 /* Set up S->gc, set clipping and draw S. */ |
2904 x_set_glyph_string_gc (s); | 2833 x_set_glyph_string_gc (s); |
2957 } | 2886 } |
2958 | 2887 |
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. */ | 2895 |
2968 #ifdef USE_FONT_BACKEND | 2896 if (s->prev && s->prev->face->underline_p) |
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 | |
2976 #ifdef USE_FONT_BACKEND | |
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, |
3005 y, s->background_width, 1); | 2934 y, s->background_width, 1); |
3006 } | 2935 } |
3027 } | 2956 } |
3028 } | 2957 } |
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; |
3036 | 2966 |
3037 if (s->face->strike_through_color_defaulted_p) | 2967 if (s->face->strike_through_color_defaulted_p) |
3069 x_draw_glyph_string_foreground (prev); | 2999 x_draw_glyph_string_foreground (prev); |
3070 else | 3000 else |
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 |
3080 if (s->next) | 3008 if (s->next) |
3081 { | 3009 { |
3096 x_draw_glyph_string_foreground (next); | 3024 x_draw_glyph_string_foreground (next); |
3097 else | 3025 else |
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 |
3116 /* Shift display to make room for inserted glyphs. */ | 3040 /* Shift display to make room for inserted glyphs. */ |
3117 | 3041 |
5851 */ | 5775 */ |
5852 | 5776 |
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. |
5859 The return value shows which font we chose. */ | 5785 The return value shows which font we chose. */ |
5860 | 5786 |
5949 /* Since x_new_font doesn't update any fontset information, do it now. */ | 5875 /* Since x_new_font doesn't update any fontset information, do it now. */ |
5950 FRAME_FONTSET(f) = fontset; | 5876 FRAME_FONTSET(f) = fontset; |
5951 | 5877 |
5952 return fontset_name (fontset); | 5878 return fontset_name (fontset); |
5953 } | 5879 } |
5954 | 5880 #endif /* OLD_FONT */ |
5955 #ifdef USE_FONT_BACKEND | 5881 |
5882 | |
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; |
5886 Lisp_Object font_object; | |
5959 int fontset; | 5887 int fontset; |
5960 Lisp_Object font_object; | 5888 { |
5961 { | 5889 struct font *font = XFONT_OBJECT (font_object); |
5962 struct font *font = XSAVE_VALUE (font_object)->pointer; | 5890 |
5963 | 5891 if (fontset < 0) |
5964 if (FRAME_FONT_OBJECT (f) == font) | 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 |
5982 /* Compute the scroll bar width in character columns. */ | 5909 /* Compute the scroll bar width in character columns. */ |
5983 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0) | 5910 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0) |
6010 | 5937 |
6011 UNBLOCK_INPUT; | 5938 UNBLOCK_INPUT; |
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 /*********************************************************************** |
6019 TODO: W32 Input Methods | 5945 TODO: W32 Input Methods |
6020 ***********************************************************************/ | 5946 ***********************************************************************/ |
6567 { | 6493 { |
6568 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 6494 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (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)); |
6583 | 6506 |
6584 free_frame_menubar (f); | 6507 free_frame_menubar (f); |
6679 | 6602 |
6680 /*********************************************************************** | 6603 /*********************************************************************** |
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 |
6687 x_get_font_info (f, font_idx) | 6612 x_get_font_info (f, font_idx) |
6688 x_list_fonts (f, pattern, size, maxnames) | 6613 x_list_fonts (f, pattern, size, maxnames) |
6781 x_load_font (f, fontname, size) | 6706 x_load_font (f, fontname, size) |
6782 x_query_font (f, fontname) | 6707 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 |
6789 ***********************************************************************/ | 6717 ***********************************************************************/ |
6790 | 6718 |
6914 w32_get_glyph_overhangs, | 6842 w32_get_glyph_overhangs, |
6915 x_fix_overlapping_area, | 6843 x_fix_overlapping_area, |
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, |
6924 w32_clear_frame_area, | 6854 w32_clear_frame_area, |
6925 w32_draw_window_cursor, | 6855 w32_draw_window_cursor, |
7003 delete_terminal calls us back when it deletes our last frame. */ | 6933 delete_terminal calls us back when it deletes our last frame. */ |
7004 if (!terminal->name) | 6934 if (!terminal->name) |
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; |
7017 } | 6949 } |
7018 | 6950 |
7137 } | 7069 } |
7138 dpyinfo->color_list = NULL; | 7070 dpyinfo->color_list = NULL; |
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 (); |
7146 } | 7080 } |
7147 | 7081 |