1467 the fonts point-size is scaled as appropriate. |
1467 the fonts point-size is scaled as appropriate. |
1468 Assuming that device can only draw in device colors, we have to handle |
1468 Assuming that device can only draw in device colors, we have to handle |
1469 the case where paint and/or bgPaint are dithered colors" |
1469 the case where paint and/or bgPaint are dithered colors" |
1470 |
1470 |
1471 |easy w h savedPaint fgId bgId |
1471 |easy w h savedPaint fgId bgId |
1472 id pX pY fontUsed sz s| |
1472 id pX pY fontUsed fontsEncoding sz s| |
1473 |
1473 |
1474 " |
1474 " |
1475 if backgroundPaint color is nil, we assume |
1475 if backgroundPaint color is nil, we assume |
1476 this is a non-opaque draw |
1476 this is a non-opaque draw |
1477 " |
1477 " |
1525 fontUsed displayOpaqueString:aString from:index1 to:index2 x:x y:y in:self. |
1525 fontUsed displayOpaqueString:aString from:index1 to:index2 x:x y:y in:self. |
1526 ^ self |
1526 ^ self |
1527 ]. |
1527 ]. |
1528 |
1528 |
1529 s := aString. |
1529 s := aString. |
1530 s encoding ~~ font encoding ifTrue:[ |
1530 fontUsed := fontUsed onDevice:device. |
1531 s := s encodeForDisplayInto:(font encoding). |
1531 fontsEncoding := fontUsed encoding. |
|
1532 (characterEncoding notNil and:[characterEncoding ~~ fontsEncoding]) ifTrue:[ |
|
1533 s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding. |
1532 ]. |
1534 ]. |
1533 |
1535 |
1534 " |
1536 " |
1535 if bgPaint or paint is not a real Color, we have to do it the hard way ... |
1537 if bgPaint or paint is not a real Color, we have to do it the hard way ... |
1536 " |
1538 " |
1550 bgId isNil ifTrue:[ |
1552 bgId isNil ifTrue:[ |
1551 easy := false |
1553 easy := false |
1552 ] |
1554 ] |
1553 ]. |
1555 ]. |
1554 |
1556 |
|
1557 deviceFont ~~ fontUsed ifTrue:[ |
|
1558 device setFont:id in:gcId. |
|
1559 deviceFont := fontUsed |
|
1560 ]. |
|
1561 |
1555 easy ifTrue:[ |
1562 easy ifTrue:[ |
1556 deviceFont ~~ fontUsed ifTrue:[ |
|
1557 device setFont:id in:gcId. |
|
1558 deviceFont := fontUsed |
|
1559 ]. |
|
1560 |
|
1561 device setForeground:fgId background:bgId in:gcId. |
1563 device setForeground:fgId background:bgId in:gcId. |
1562 foreground := paint. |
1564 foreground := paint. |
1563 background := bgPaint. |
1565 background := bgPaint. |
1564 device displayOpaqueString:s |
1566 device displayOpaqueString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId. |
1565 from:index1 to:index2 |
|
1566 x:pX y:pY |
|
1567 in:drawableId with:gcId. |
|
1568 ^ self |
1567 ^ self |
1569 ]. |
1568 ]. |
1570 |
1569 |
1571 w := fontUsed widthOf:s from:index1 to:index2. |
1570 w := fontUsed widthOf:s from:index1 to:index2. |
1572 h := fontUsed height. |
1571 h := fontUsed height. |
1573 |
1572 |
1574 (fgId notNil and:[function == #copy]) ifTrue:[ |
1573 (fgId notNil and:[function == #copy]) ifTrue:[ |
1575 deviceFont ~~ fontUsed ifTrue:[ |
|
1576 device setFont:id in:gcId. |
|
1577 deviceFont := fontUsed |
|
1578 ]. |
|
1579 " |
1574 " |
1580 only bg is dithered; fill with bg first ... |
1575 only bg is dithered; fill with bg first ... |
1581 " |
1576 " |
1582 savedPaint := paint. |
1577 savedPaint := paint. |
1583 self paint:bgPaint. |
1578 self paint:bgPaint. |
1606 background pixels in bgPaint color. If the transformation involves scaling, |
1598 background pixels in bgPaint color. If the transformation involves scaling, |
1607 the fonts point-size is scaled as appropriate. |
1599 the fonts point-size is scaled as appropriate. |
1608 Assuming that device can only draw in device colors, we have to handle |
1600 Assuming that device can only draw in device colors, we have to handle |
1609 the case where paint and/or bgPaint are dithered colors or images." |
1601 the case where paint and/or bgPaint are dithered colors or images." |
1610 |
1602 |
1611 |id easy fgId bgId pX pY fontUsed sz s| |
1603 |id easy fgId bgId pX pY fontUsed fontsEncoding sz s| |
1612 |
1604 |
1613 " |
1605 " |
1614 if backgroundPaint color is nil, we assume |
1606 if backgroundPaint color is nil, we assume |
1615 this is a non-opaque draw |
1607 this is a non-opaque draw |
1616 " |
1608 " |
1682 pY := y. |
1672 pY := y. |
1683 ]. |
1673 ]. |
1684 pX := pX rounded. |
1674 pX := pX rounded. |
1685 pY := pY rounded. |
1675 pY := pY rounded. |
1686 |
1676 |
|
1677 s := aString. |
1687 fontUsed := fontUsed onDevice:device. |
1678 fontUsed := fontUsed onDevice:device. |
|
1679 fontsEncoding := fontUsed encoding. |
|
1680 (characterEncoding notNil and:[characterEncoding ~~ fontsEncoding]) ifTrue:[ |
|
1681 s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding. |
|
1682 ]. |
1688 |
1683 |
1689 id := fontUsed fontId. |
1684 id := fontUsed fontId. |
1690 id isNil ifTrue:[ |
1685 id isNil ifTrue:[ |
1691 " |
1686 " |
1692 hook for alien fonts |
1687 hook for alien fonts |
1693 that 'font' should know how to display the string ... |
1688 that 'font' should know how to display the string ... |
1694 " |
1689 " |
1695 fontUsed displayOpaqueString:aString from:1 to:(aString size) x:x y:y in:self. |
1690 fontUsed displayOpaqueString:s from:1 to:(s size) x:x y:y in:self. |
1696 ^ self |
1691 ] ifFalse:[ |
1697 ]. |
1692 deviceFont ~~ fontUsed ifTrue:[ |
1698 |
1693 device setFont:id in:gcId. |
1699 s := aString. |
1694 deviceFont := fontUsed |
1700 s encoding ~~ font encoding ifTrue:[ |
1695 ]. |
1701 s := s encodeForDisplayInto:(font encoding). |
1696 |
1702 ]. |
1697 device setForeground:fgId background:bgId in:gcId. |
1703 |
1698 foreground := paint. |
1704 deviceFont ~~ fontUsed ifTrue:[ |
1699 background := bgPaint. |
1705 device setFont:id in:gcId. |
1700 device displayOpaqueString:s x:pX y:pY in:drawableId with:gcId. |
1706 deviceFont := fontUsed |
1701 ]. |
1707 ]. |
|
1708 |
|
1709 |
|
1710 device setForeground:fgId background:bgId in:gcId. |
|
1711 foreground := paint. |
|
1712 background := bgPaint. |
|
1713 device displayOpaqueString:s |
|
1714 x:pX y:pY |
|
1715 in:drawableId with:gcId. |
|
1716 |
1702 |
1717 "Modified: 30.6.1997 / 15:06:17 / cg" |
1703 "Modified: 30.6.1997 / 15:06:17 / cg" |
1718 ! |
1704 ! |
1719 |
1705 |
1720 displayPointX:x y:y |
1706 displayPointX:x y:y |
1849 "draw a substring at the coordinate x/y - |
1835 "draw a substring at the coordinate x/y - |
1850 draw foreground-pixels only (in current paint-color), |
1836 draw foreground-pixels only (in current paint-color), |
1851 leaving background as-is. If the transformation involves scaling, |
1837 leaving background as-is. If the transformation involves scaling, |
1852 the fonts point-size is scaled as appropriate." |
1838 the fonts point-size is scaled as appropriate." |
1853 |
1839 |
1854 |id pX pY fontUsed sz s fEnc| |
1840 |id pX pY fontUsed sz s fontsEncoding| |
1855 |
1841 |
1856 "hook for non-strings (i.e. attributed text)" |
1842 "hook for non-strings (i.e. attributed text)" |
1857 (aString isString not |
1843 (aString isString not |
1858 or:[aString isText]) ifTrue:[ |
1844 or:[aString isText]) ifTrue:[ |
1859 ^ aString displayOn:self x:x y:y from:index1 to:index2 |
1845 ^ aString displayOn:self x:x y:y from:index1 to:index2 |
1881 pY := y. |
1867 pY := y. |
1882 ]. |
1868 ]. |
1883 pX := pX rounded. |
1869 pX := pX rounded. |
1884 pY := pY rounded. |
1870 pY := pY rounded. |
1885 |
1871 |
|
1872 s := aString. |
1886 fontUsed := fontUsed onDevice:device. |
1873 fontUsed := fontUsed onDevice:device. |
|
1874 fontsEncoding := fontUsed encoding. |
|
1875 (characterEncoding notNil and:[characterEncoding ~~ fontsEncoding]) ifTrue:[ |
|
1876 s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding. |
|
1877 ]. |
1887 |
1878 |
1888 id := fontUsed fontId. |
1879 id := fontUsed fontId. |
1889 id isNil ifTrue:[ |
1880 id isNil ifTrue:[ |
1890 "hook for alien fonts" |
1881 "hook for alien fonts" |
1891 font displayString:aString from:index1 to:index2 x:x y:y in:self. |
1882 font displayString:s from:index1 to:index2 x:x y:y in:self. |
1892 ^ self |
1883 ] ifFalse:[ |
1893 ]. |
1884 deviceFont ~~ fontUsed ifTrue:[ |
1894 |
1885 device setFont:id in:gcId. |
1895 s := aString. |
1886 deviceFont := fontUsed |
1896 s encoding ~~ (fEnc := font encoding) ifTrue:[ |
1887 ]. |
1897 s := s encodeForDisplayInto:fEnc. |
1888 device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId |
1898 ]. |
1889 ]. |
1899 |
|
1900 deviceFont ~~ fontUsed ifTrue:[ |
|
1901 device setFont:id in:gcId. |
|
1902 deviceFont := fontUsed |
|
1903 ]. |
|
1904 device displayString:s from:index1 to:index2 |
|
1905 x:pX y:pY in:drawableId with:gcId |
|
1906 |
1890 |
1907 "Modified: 1.7.1997 / 17:08:44 / cg" |
1891 "Modified: 1.7.1997 / 17:08:44 / cg" |
1908 ! |
1892 ! |
1909 |
1893 |
1910 displayString:aString x:x y:y |
1894 displayString:aString x:x y:y |
1911 "draw a string at the coordinate x/y - |
1895 "draw a string at the coordinate x/y - |
1912 draw foreground-pixels only (in current paint-color), |
1896 draw foreground-pixels only (in current paint-color), |
1913 leaving background as-is. If the transformation involves scaling, |
1897 leaving background as-is. If the transformation involves scaling, |
1914 the fonts point-size is scaled as appropriate." |
1898 the fonts point-size is scaled as appropriate." |
1915 |
1899 |
1916 |id pX pY fontUsed sz s fEnc| |
1900 |id pX pY fontUsed sz s fontsEncoding| |
1917 |
1901 |
1918 "hook for non-strings (i.e. attributed text)" |
1902 "hook for non-strings (i.e. attributed text)" |
1919 (aString isString not |
1903 (aString isString not |
1920 or:[aString isText]) ifTrue:[ |
1904 or:[aString isText]) ifTrue:[ |
1921 ^ aString displayOn:self x:x y:y |
1905 ^ aString displayOn:self x:x y:y |
1943 pY := y. |
1927 pY := y. |
1944 ]. |
1928 ]. |
1945 pX := pX rounded. |
1929 pX := pX rounded. |
1946 pY := pY rounded. |
1930 pY := pY rounded. |
1947 |
1931 |
|
1932 s := aString. |
1948 fontUsed := fontUsed onDevice:device. |
1933 fontUsed := fontUsed onDevice:device. |
|
1934 fontsEncoding := fontUsed encoding. |
|
1935 (characterEncoding notNil and:[characterEncoding ~~ fontsEncoding]) ifTrue:[ |
|
1936 s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding. |
|
1937 ]. |
1949 |
1938 |
1950 id := fontUsed fontId. |
1939 id := fontUsed fontId. |
1951 id isNil ifTrue:[ |
1940 id isNil ifTrue:[ |
1952 "hook for alien fonts" |
1941 "hook for alien fonts" |
1953 fontUsed displayString:aString x:x y:y in:self |
1942 fontUsed displayString:s x:x y:y in:self |
1954 ] ifFalse:[ |
1943 ] ifFalse:[ |
1955 s := aString. |
|
1956 s encoding ~~ (fEnc := fontUsed encoding) ifTrue:[ |
|
1957 s := s encodeForDisplayInto:fEnc. |
|
1958 ]. |
|
1959 |
|
1960 deviceFont ~~ fontUsed ifTrue:[ |
1944 deviceFont ~~ fontUsed ifTrue:[ |
1961 device setFont:id in:gcId. |
1945 device setFont:id in:gcId. |
1962 deviceFont := fontUsed |
1946 deviceFont := fontUsed |
1963 ]. |
1947 ]. |
1964 device displayString:s x:pX y:pY in:drawableId with:gcId |
1948 device displayString:s x:pX y:pY in:drawableId with:gcId |
2882 the case where paint and/or bgPaint are dithered colors. |
2866 the case where paint and/or bgPaint are dithered colors. |
2883 No translation or scaling is done." |
2867 No translation or scaling is done." |
2884 |
2868 |
2885 |easy w h savedPaint fgId bgId allColor allBits noColor |
2869 |easy w h savedPaint fgId bgId allColor allBits noColor |
2886 id bgForm fgForm tmpForm maskForm dx dy pX pY fontUsed s |
2870 id bgForm fgForm tmpForm maskForm dx dy pX pY fontUsed s |
2887 deviceDepth fEnc ascent| |
2871 deviceDepth fontsEncoding ascent| |
2888 |
2872 |
2889 " |
2873 " |
2890 if backgroundPaint color is nil, we assume |
2874 if backgroundPaint color is nil, we assume |
2891 this is a non-opaque draw |
2875 this is a non-opaque draw |
2892 " |
2876 " |
2910 ]. |
2894 ]. |
2911 |
2895 |
2912 pX := x rounded. |
2896 pX := x rounded. |
2913 pY := y rounded. |
2897 pY := y rounded. |
2914 |
2898 |
2915 fontUsed := font onDevice:device. |
2899 s := aString. |
|
2900 fontUsed := fontUsed onDevice:device. |
|
2901 fontsEncoding := fontUsed encoding. |
|
2902 (characterEncoding notNil and:[characterEncoding ~~ fontsEncoding]) ifTrue:[ |
|
2903 s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding. |
|
2904 ]. |
2916 |
2905 |
2917 id := fontUsed fontId. |
2906 id := fontUsed fontId. |
2918 id isNil ifTrue:[ |
2907 id isNil ifTrue:[ |
2919 " |
2908 " |
2920 hook for alien fonts |
2909 hook for alien fonts |
2921 that 'font' should know how to display the string ... |
2910 that 'font' should know how to display the string ... |
2922 " |
2911 " |
2923 font displayOpaqueString:aString from:index1 to:index2 x:x y:y in:self. |
2912 font displayOpaqueString:s from:index1 to:index2 x:x y:y in:self. |
2924 ^ self |
2913 ^ self |
2925 ]. |
|
2926 |
|
2927 s := aString. |
|
2928 s encoding ~~ (fEnc := font encoding) ifTrue:[ |
|
2929 s := s encodeForDisplayInto:fEnc. |
|
2930 ]. |
2914 ]. |
2931 |
2915 |
2932 deviceFont ~~ fontUsed ifTrue:[ |
2916 deviceFont ~~ fontUsed ifTrue:[ |
2933 device setFont:id in:gcId. |
2917 device setFont:id in:gcId. |
2934 deviceFont := fontUsed |
2918 deviceFont := fontUsed |
2957 |
2941 |
2958 easy ifTrue:[ |
2942 easy ifTrue:[ |
2959 device setForeground:fgId background:bgId in:gcId. |
2943 device setForeground:fgId background:bgId in:gcId. |
2960 foreground := paint. |
2944 foreground := paint. |
2961 background := bgPaint. |
2945 background := bgPaint. |
2962 device displayOpaqueString:s |
2946 device displayOpaqueString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId. |
2963 from:index1 to:index2 |
|
2964 x:pX y:pY |
|
2965 in:drawableId with:gcId. |
|
2966 ^ self |
2947 ^ self |
2967 ]. |
2948 ]. |
2968 |
2949 |
2969 w := fontUsed widthOf:s from:index1 to:index2. |
2950 w := fontUsed widthOf:s from:index1 to:index2. |
2970 h := fontUsed height. |
2951 h := fontUsed height. |
2980 self paint:savedPaint. |
2961 self paint:savedPaint. |
2981 |
2962 |
2982 " |
2963 " |
2983 then draw using fgPaint (which is a real color) |
2964 then draw using fgPaint (which is a real color) |
2984 " |
2965 " |
2985 device displayString:s |
2966 device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId. |
2986 from:index1 to:index2 |
|
2987 x:pX y:pY |
|
2988 in:drawableId with:gcId. |
|
2989 ^ self |
2967 ^ self |
2990 ]. |
2968 ]. |
2991 |
2969 |
2992 allColor := Color allColor. |
2970 allColor := Color allColor. |
2993 allBits := allColor colorId. |
2971 allBits := allColor colorId. |
3060 ] ifFalse:[ |
3038 ] ifFalse:[ |
3061 device setPixmapMask:mask id in:gcId |
3039 device setPixmapMask:mask id in:gcId |
3062 ]. |
3040 ]. |
3063 ]. |
3041 ]. |
3064 |
3042 |
3065 device displayString:s |
3043 device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId. |
3066 from:index1 to:index2 |
|
3067 x:pX y:pY |
|
3068 in:drawableId with:gcId. |
|
3069 ^ self. |
3044 ^ self. |
3070 "/ |
|
3071 "/ " |
|
3072 "/ if bgPaint color is all-0 or all-1's, we can do it in one |
|
3073 "/ operation ... |
|
3074 "/ " |
|
3075 "/ ((bgId ~~ ((1 bitShift:deviceDepth)-1)) |
|
3076 "/ and:[bgId ~~ allBits]) ifTrue:[ |
|
3077 "/ " |
|
3078 "/ clear bg bits ... |
|
3079 "/ " |
|
3080 "/ device setForeground:allBits background:0 in:gcId. |
|
3081 "/ device setFunction:#and in:gcId. |
|
3082 "/ device displayOpaqueString:s |
|
3083 "/ from:index1 to:index2 |
|
3084 "/ x:pX y:pY |
|
3085 "/ in:drawableId with:gcId. |
|
3086 "/ ]. |
|
3087 "/ |
|
3088 "/ " |
|
3089 "/ or-in bg bits ... |
|
3090 "/ " |
|
3091 "/ bgId ~~ 0 ifTrue:[ |
|
3092 "/ device setForeground:0 background:bgId in:gcId. |
|
3093 "/ device setFunction:#or in:gcId. |
|
3094 "/ device displayOpaqueString:s |
|
3095 "/ from:index1 to:index2 |
|
3096 "/ x:pX y:pY |
|
3097 "/ in:drawableId with:gcId. |
|
3098 "/ ]. |
|
3099 "/ " |
|
3100 "/ flush foreground/background cache |
|
3101 "/ " |
|
3102 "/ foreground := nil. |
|
3103 "/ background := nil. |
|
3104 "/ device setFunction:function in:gcId. |
|
3105 "/ ^ self |
|
3106 ]. |
3045 ]. |
3107 |
3046 |
3108 " |
3047 " |
3109 very hard case, both fg and bg are dithered colors/images |
3048 very hard case, both fg and bg are dithered colors/images |
3110 " |
3049 " |
3111 noColor := Color noColor. |
3050 noColor := Color noColor. |
3112 "/ 'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR. |
3051 |
3113 " |
3052 " |
3114 create temp-forms; |
3053 create temp-forms; |
3115 " |
3054 " |
3116 bgForm := Form width:w height:h depth:deviceDepth on:device. |
3055 bgForm := Form width:w height:h depth:deviceDepth on:device. |
3117 fgForm := Form width:w height:h depth:deviceDepth on:device. |
3056 fgForm := Form width:w height:h depth:deviceDepth on:device. |
3140 stamp-out background (have now bg-bits with fg=0 in bgForm) |
3079 stamp-out background (have now bg-bits with fg=0 in bgForm) |
3141 " |
3080 " |
3142 bgForm font:fontUsed. |
3081 bgForm font:fontUsed. |
3143 bgForm paint:noColor on:allColor. |
3082 bgForm paint:noColor on:allColor. |
3144 bgForm function:#and. |
3083 bgForm function:#and. |
3145 bgForm displayString:s |
3084 bgForm displayString:s from:index1 to:index2 x:0 y:ascent. |
3146 from:index1 to:index2 |
|
3147 x:0 y:ascent. |
|
3148 |
3085 |
3149 " |
3086 " |
3150 stamp-out foreground |
3087 stamp-out foreground |
3151 " |
3088 " |
3152 maskForm font:fontUsed. |
3089 maskForm font:fontUsed. |
3153 maskForm paint:allColor on:noColor. |
3090 maskForm paint:allColor on:noColor. |
3154 maskForm displayOpaqueString:s |
3091 maskForm displayOpaqueString:s from:index1 to:index2 x:0 y:ascent. |
3155 from:index1 to:index2 |
|
3156 x:0 y:ascent. |
|
3157 |
3092 |
3158 fgForm function:#and. |
3093 fgForm function:#and. |
3159 fgForm copyFrom:maskForm x:0 y:0 toX:0 y:0 width:w height:h. |
3094 fgForm copyFrom:maskForm x:0 y:0 toX:0 y:0 width:w height:h. |
3160 |
3095 |
3161 " |
3096 " |
3175 finally, draw it |
3110 finally, draw it |
3176 " |
3111 " |
3177 device setForeground:0 background:allBits in:gcId. |
3112 device setForeground:0 background:allBits in:gcId. |
3178 device |
3113 device |
3179 copyFromId:tmpForm id |
3114 copyFromId:tmpForm id |
3180 x:0 y:0 gc:tmpForm gcId |
3115 x:0 y:0 gc:tmpForm gcId |
3181 to:drawableId |
3116 to:drawableId |
3182 x:pX y:(pY-ascent) gc:gcId |
3117 x:pX y:(pY-ascent) gc:gcId |
3183 width:w height:h. |
3118 width:w height:h. |
3184 |
3119 |
3185 " |
3120 " |
3186 release tempForms immediately |
3121 release tempForms immediately |
3187 (although GC will eventually do it, |
3122 (although GC will eventually do it, |
3188 this creates less stress to the Xserver in the meanwhile ...) |
3123 this creates less stress to the Xserver in the meanwhile ...) |
3222 displayDeviceString:aString from:index1 to:index2 in:font x:x y:y |
3157 displayDeviceString:aString from:index1 to:index2 in:font x:x y:y |
3223 "draw a substring at the coordinate x/y - |
3158 "draw a substring at the coordinate x/y - |
3224 draw foreground-pixels only (in current paint-color), leaving background as-is. |
3159 draw foreground-pixels only (in current paint-color), leaving background as-is. |
3225 No translation or scaling is done" |
3160 No translation or scaling is done" |
3226 |
3161 |
3227 |id pX pY fontUsed s fEnc| |
3162 |id pX pY fontUsed s fontsEncoding| |
3228 |
3163 |
3229 " |
3164 " |
3230 hook for non-strings (i.e. attributed text) |
3165 hook for non-strings (i.e. attributed text) |
3231 " |
3166 " |
3232 (aString isString not |
3167 (aString isString not |
3239 ]. |
3174 ]. |
3240 |
3175 |
3241 pX := x rounded. |
3176 pX := x rounded. |
3242 pY := y rounded. |
3177 pY := y rounded. |
3243 |
3178 |
3244 fontUsed := font onDevice:device. |
3179 s := aString. |
|
3180 fontUsed := fontUsed onDevice:device. |
|
3181 fontsEncoding := fontUsed encoding. |
|
3182 (characterEncoding notNil and:[characterEncoding ~~ fontsEncoding]) ifTrue:[ |
|
3183 s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding. |
|
3184 ]. |
3245 |
3185 |
3246 id := fontUsed fontId. |
3186 id := fontUsed fontId. |
3247 id isNil ifTrue:[ |
3187 id isNil ifTrue:[ |
3248 "hook for alien fonts" |
3188 "hook for alien fonts" |
3249 font displayString:aString from:index1 to:index2 x:x y:y in:self |
3189 font displayString:s from:index1 to:index2 x:x y:y in:self |
3250 ] ifFalse:[ |
3190 ] ifFalse:[ |
3251 s := aString. |
|
3252 s encoding ~~ (fEnc := font encoding) ifTrue:[ |
|
3253 s := s encodeForDisplayInto:fEnc. |
|
3254 ]. |
|
3255 |
|
3256 deviceFont ~~ fontUsed ifTrue:[ |
3191 deviceFont ~~ fontUsed ifTrue:[ |
3257 device setFont:id in:gcId. |
3192 device setFont:id in:gcId. |
3258 deviceFont := fontUsed |
3193 deviceFont := fontUsed |
3259 ]. |
3194 ]. |
3260 device displayString:s from:index1 to:index2 |
3195 device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId |
3261 x:pX y:pY in:drawableId with:gcId |
|
3262 ] |
3196 ] |
3263 |
3197 |
3264 "Modified: 1.7.1997 / 17:08:48 / cg" |
3198 "Modified: 1.7.1997 / 17:08:48 / cg" |
3265 ! |
3199 ! |
3266 |
3200 |