comparison man/internals/internals.texi @ 2405:a27c2650a716

[xemacs-hg @ 2004-11-26 04:55:24 by stephent] document sjt-xft branch <87vfbtw6qu.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Fri, 26 Nov 2004 04:55:28 +0000
parents 2d4dd2ef74e7
children 87cfc6698054
comparison
equal deleted inserted replaced
2404:91ef492f6945 2405:a27c2650a716
636 * Future Work -- Macros:: 636 * Future Work -- Macros::
637 * Future Work -- Specifiers:: 637 * Future Work -- Specifiers::
638 * Future Work -- Display Tables:: 638 * Future Work -- Display Tables::
639 * Future Work -- Making Elisp Function Calls Faster:: 639 * Future Work -- Making Elisp Function Calls Faster::
640 * Future Work -- Lisp Engine Replacement:: 640 * Future Work -- Lisp Engine Replacement::
641 * Future Work -- Better Rendering Support::
641 642
642 Future Work -- Toolbars 643 Future Work -- Toolbars
643 644
644 * Future Work -- Easier Toolbar Customization:: 645 * Future Work -- Easier Toolbar Customization::
645 * Future Work -- Toolbar Interface Changes:: 646 * Future Work -- Toolbar Interface Changes::
17521 * Future Work -- Macros:: 17522 * Future Work -- Macros::
17522 * Future Work -- Specifiers:: 17523 * Future Work -- Specifiers::
17523 * Future Work -- Display Tables:: 17524 * Future Work -- Display Tables::
17524 * Future Work -- Making Elisp Function Calls Faster:: 17525 * Future Work -- Making Elisp Function Calls Faster::
17525 * Future Work -- Lisp Engine Replacement:: 17526 * Future Work -- Lisp Engine Replacement::
17527 * Future Work -- Better Rendering Support::
17526 @end menu 17528 @end menu
17527 17529
17528 @node Future Work -- General Suggestions, Future Work -- Elisp Compatibility Package, Future Work, Future Work 17530 @node Future Work -- General Suggestions, Future Work -- Elisp Compatibility Package, Future Work, Future Work
17529 @section Future Work -- General Suggestions 17531 @section Future Work -- General Suggestions
17530 @cindex future work, general suggestions 17532 @cindex future work, general suggestions
22360 true and is false. (Note: the optimization detailed in this item is 22362 true and is false. (Note: the optimization detailed in this item is
22361 probably not worth doing on the first pass.) 22363 probably not worth doing on the first pass.)
22362 22364
22363 @end itemize 22365 @end itemize
22364 22366
22365 @node Future Work -- Lisp Engine Replacement, , Future Work -- Making Elisp Function Calls Faster, Future Work 22367 @node Future Work -- Lisp Engine Replacement, Future Work -- Better Rendering Support, Future Work -- Making Elisp Function Calls Faster, Future Work
22366 @section Future Work -- Lisp Engine Replacement 22368 @section Future Work -- Lisp Engine Replacement
22367 @cindex future work, lisp engine replacement 22369 @cindex future work, lisp engine replacement
22368 @cindex lisp engine replacement, future work 22370 @cindex lisp engine replacement, future work
22369 22371
22370 @menu 22372 @menu
22970 Hrvoje, do you have any interest in this? How about you, Martin? 22972 Hrvoje, do you have any interest in this? How about you, Martin?
22971 This seems like it might be up your alley. This stuff has been 22973 This seems like it might be up your alley. This stuff has been
22972 ad-hocked since kingdom come, and it's high time that we make this 22974 ad-hocked since kingdom come, and it's high time that we make this
22973 work properly so that it could be relied upon, and a lot of things 22975 work properly so that it could be relied upon, and a lot of things
22974 could "just work". 22976 could "just work".
22977
22978
22979 @node Future Work -- Better Rendering Support, , Future Work -- Lisp Engine Replacement, Future Work
22980 @section Future Work -- Better Rendering Support
22981 @cindex future work, better rendering support
22982 @cindex better rendering support, future work
22983
22984 This section was written by Stephen Turnbull <stephen@@xemacs.org>, so
22985 don't blame Ben (or Eric and Matthias, for that matter). Feel free to
22986 add, edit, and share the blame, guys!
22987
22988 @c #### make these @urlref's!!
22989 As of late November 2004, this principally means adding support for the
22990 @file{Xft} library, which provides a more robust @emph{font
22991 configuration} mechanism via Keith Packard's @file{fontconfig} library
22992 improved glyph rendering, including antialiasing, via the
22993 @file{freetype} library, and client-side rendering (saving bandwidth and
22994 server memory) via the @file{XRender extension}. In fact, patches which
22995 provide Xft support have been available for several years, but the
22996 authors have been unwilling to deal with several important issues which
22997 block integration. These are @emph{Mule}, and more generally,
22998 @emph{face} support; @emph{widget} support (including the toolbar and
22999 menubar); and @emph{redisplay refactoring}.
23000
23001 @c Describe Alexey Gladkov and Yury Konovalov's work.
23002
23003 However, in late 2003 Eric Knauel <knauel@@informatik.uni-tuebingen.de>
23004 and Matthias Neubauer <neubauer@@informatik.uni-freiburg.de> put forward
23005 a relatively complete patch which was robust to daily use in ISO 8859-1
23006 locales, and Stephen Turnbull began work on the integration issues. At
23007 this point a (private) CVS branch is available for Stephen's patch
23008 (branch point tag @samp{sjt-xft-bp}, branch tag @samp{sjt-xft}), and
23009 one may be made available for the Knauel-Matthias patch soon.
23010
23011 @menu
23012 * Better Rendering Support -- Issues::
23013 * Better Rendering Support -- Implementation::
23014 * Better Rendering Support -- Current Status::
23015 * Better Rendering Support -- Configuration with the Interim Patches::
23016 @end menu
23017
23018
23019 @node Better Rendering Support -- Issues, Better Rendering Support -- Implementation, , Future Work -- Better Rendering Support
23020 @subsection Better Rendering Support -- Issues
23021 @cindex better rendering support, issues
23022 @cindex issues, better rendering support
23023
23024 Of course it's ``unfair'' to demand that the implementers of a nice
23025 feature like anti-aliasing support deal with accumulated cruft of the
23026 last few years, but somebody must, sometime soon. Even core developers
23027 are complaining about how slow XEmacs is in some applications, and there
23028 is reason to believe that some of the problem is in redisplay.
23029 Adding more @emph{ad hoc} features to redisplay will make the whole
23030 module more complex and unintelligible. Even if it doesn't inherently
23031 further detract from efficiency, it will surely make reform and
23032 refactoring harder.
23033
23034 Similar considerations apply to Mule support. If Xft support is not
23035 carefully designed, or implemented with Mule support soon, it will
23036 undoubtedly make later Mule implementation far more difficult than it
23037 needs to be, and require redundant work be done (@emph{e.g.}, on
23038 @samp{Options} menu support).
23039
23040 Besides the design issue---and many users are requesting more
23041 flexibility, primarily face support, from the widgets---with widget
23042 support there is also an aesthetic issue. It is horribly unimpressive to
23043 have clunky bitmapped fonts on the decorations when pleasant antialiased
23044 fonts are available in the buffer.
23045
23046 Finally, these issues interact. Widgets and faces are inherently
23047 heavyweight objects, requiring orders of magnitude more computation than
23048 simply displaying a string in a fixed font. This will have an
23049 efficiency impact, of course. And they interact with each other; Mule
23050 was designed for use in buffers and display in Emacs windows---but a
23051 widget's content is usually not a buffer, and widgets need not be
23052 displayed in a window, but may appear in other contexts, especially in
23053 the gutters. So specifiers will probably have to be reworked, in order
23054 to properly support display of different faces in non-buffer, non-window
23055 contexts.
23056
23057 @node Better Rendering Support -- Implementation, Better Rendering Support -- Current Status, Better Rendering Support -- Issues, Future Work -- Better Rendering Support
23058 @subsection Better Rendering Support -- Implementation
23059 @cindex better rendering support, implementation
23060 @cindex implementation, better rendering support
23061
23062 Stephen is thinking in terms of the following components of a
23063 comprehensive proposal.
23064
23065 @table @strong
23066 @item Font configuration
23067 In XEmacs, font configuration is handled via @emph{faces}. Currently
23068 XEmacs uses a special type of @emph{font specifier} to map XEmacs
23069 locales to font names. Especially under X11, this can cause annoying
23070 problems because of the unreliability of X servers' mappings from
23071 @samp{XLFD} names to X11 fonts, over which XEmacs has no influence
23072 whatsoever. However, the @file{fontconfig} library which is used with
23073 @file{Xft} provides much more reliable mapping, along with a more
23074 reliably parsable naming scheme similar to that used by TrueType fonts
23075 on MS Windows and the Macintosh. Since the capabilities of font
23076 specifiers and @file{fontconfig} overlap, we should consider using
23077 @file{fontconfig} instead of @samp{XLFD} names. This implies that use
23078 of @file{Xft}'s rendering functionality should be separated from use of
23079 @file{fontconfig}.
23080
23081 @item Rendering engine objects
23082 With the introduction of the ``Xft patch,'' the X11, Macintosh, and MS
23083 Windows platforms are all able to support multiple font rendering
23084 engines in the same binary. Generically, there are several tasks that
23085 must be accomplished to render text on the display. In both cases the
23086 code is rather disorganized, with substantial cross-platform duplication
23087 of similar routines. While it may not be worthwhile to go the whole way
23088 to @samp{RENDERER_HAS_METHOD} and @samp{MAYBE_RENDMETH}, refactoring
23089 these modules around the notion of interfacing a ``generic rendering
23090 engine interface'' to ``text'' seems like a plausible way to focus this
23091 work.
23092
23093 @item Colors, fonts, and faces
23094 Besides the rendering engine itself, the XEmacs implementations of these
23095 objects are poorly supported by current widget implementations,
23096 including the traditional menubar and toolbar, as well as the more
23097 recent button, tab control, and progress bar widgets. The refactoring
23098 suggested under ``Rendering engine objects'' should be conducted with an
23099 eye to making these widgets support faces, perhaps even to the extent of
23100 allowing rendering to X pixmaps (which some Athena widgets support,
23101 although they will not support rendering via Xft directly). Especially
23102 with @samp{XRender} technology this should not be horribly inefficient.
23103
23104 @item Specifiers, charsets, and languages
23105 Traditionally Mule uses a rather rigid and low-level abstraction, the
23106 @emph{charset}, to characterize font repertoires. Unfortunately,
23107 support for a given charset is generally neither necessary nor
23108 sufficient to support a language. Worse, although X11's only means for
23109 indicating font repertoires is the font's @emph{registry}, the actual
23110 repertoire of many fonts is either deficient or font-dependent. The
23111 only convenience is that the registry maps directly to a Mule charset in
23112 most cases, and vice versa.
23113
23114 To date, XEmacs Mule has supported identification of appropriate fonts
23115 to support a language's repertoire of characters by identifying the
23116 repertoire as a subset of a union of charsets. To each charset there is
23117 a regular expression matching the registry portion of a font name. Then
23118 instantiation of a font proceeds by identifying the specifier domain,
23119 and then walking down the list of specifications, matching the regexp
23120 against font names until a match is found. That font is requested from
23121 the system, and if not found, the process continues similarly until a
23122 font that can be loaded is found.
23123
23124 This has several problems. First, there's no guarantee that the union
23125 will be disjoint. This problem manifests both in the case of display of
23126 Unicode representations of text in the @samp{POSIX} default locale,
23127 where glyphs are typically drawn from several inappropriate fonts. A
23128 similar problem often occurs, though for a different reason, in
23129 multilingual messages composed using @file{Gnus}'s @samp{message-mode}
23130 and MIME support. This problem @emph{cannot} be avoided with the
23131 current design; it is quite possible that a font desired in one context
23132 will be shadowed by a font intended to get higher priority in a
23133 semantically different but syntactically similar (as far as Mule can
23134 tell) context. (Of course, one could attach a different face as a text
23135 property, but that requires programming support; it can't be done by
23136 user configuration.) The problem is only exacerbated as more and more
23137 Unicode fonts, supporting large repertoires with substantial overlap
23138 across fonts, are designed and published.
23139
23140 A second problem is that registry names are often inaccurate. For
23141 example, the Japanese JIS X 0208 standard was first published in 1978
23142 (as a relabelling of an older standard). It was then revised in 1983,
23143 again in 1990, and once again in 2000, with slight changes to the
23144 repertoire and mapping in each revision. Technically, these standards
23145 can be distinguished in properly named fonts as @samp{jisx0208.1978},
23146 @samp{jisx0208.1983}, @samp{jisx0208.1990}, @samp{jisx0208.2000}, but
23147 all of them are commonly simply labelled @samp{jisx0208}, and Western
23148 distributors, of course, generally lack the expertise to correctly
23149 relabel them.
23150
23151 A third problem is that you generally can't tell if there are ``holes''
23152 in the repertoire until you try to display the glyph.
23153
23154 The TrueType fonts (and the later OpenType standard) provides for a
23155 proper character set query (as a Boolean vector indexed by Unicode code
23156 points), as well as providing a list of supported languages.
23157
23158 I propose that we take advantage of these latter facilities by allowing
23159 a font to be specified either as a string (a font name), or as a list
23160 whose head is the font name and whose tail is a list of languages and
23161 Mule charsets (for backward compatibility) that user intends to use the
23162 font to display. This will probably require a change to the specifier
23163 code.
23164
23165 As mentioned above, specifiers will probably also have to be enhanced to
23166 recognize @samp{widget} locales and domains, instead of the current hack
23167 where special @samp{widget} and @samp{gui-element} faces are created.
23168
23169 @item Customize
23170
23171 Customize needs to deal with all this stuff!!
23172 @end table
23173
23174
23175 @node Better Rendering Support -- Current Status, Better Rendering Support -- Configuration with the Interim Patches, Better Rendering Support -- Implementation, Future Work -- Better Rendering Support
23176 @subsection Better Rendering Support -- Current Status
23177 @cindex better rendering support, current status
23178 @cindex current status, better rendering support
23179
23180 Stephen has a branch containing his stuff in XEmacs CVS. The branch
23181 point tag is @samp{sjt-xft-bp}, roughly corresponding to XEmacs 21.5.18,
23182 and branch tag is @samp{sjt-xft}.
23183
23184 @node Better Rendering Support -- Configuration with the Interim Patches, , Better Rendering Support -- Current Status, Future Work -- Better Rendering Support
23185 @subsection Better Rendering Support -- Configuration with the Interim Patches
23186 @cindex better rendering support, configuration with the interim patches
23187 @cindex configuration with the interim patches, better rendering support
23188
23189 For Stephen's @samp{sjt-xft} branch, you should keep the following in
23190 mind when configuring:
23191
23192 @itemize
23193 @item
23194 The only way to configure widget fonts at the present time is to use X
23195 resources (or hack the source and rebuild). Currently supported widgets
23196 are
23197 @itemize
23198 @item
23199 menubars
23200 @item
23201 tab controls
23202 @end itemize
23203 @item
23204 Because fonts supporting other languages tend to support English as
23205 well, if you want to use one font for English and another for the other
23206 language, you must use the @code{append} method when adding font
23207 specifications for the other language.
23208
23209 However, this leaves you with a problem if you want to change the other
23210 language's font: you have to remove the existing specification so it
23211 won't shadow the new one when you append.
23212
23213 I use @code{define-specifier-tag} like this:
23214
23215 @example
23216 (define-specifier-tag 'lang-ja)
23217 ;; No, I don't try to do real work with this font! But it makes it
23218 ;; obvious that I got the requested font. :-)
23219 (set-face-font 'default "AirCut-14")
23220 (set-face-font 'default "Kochi Mincho-14" nil '(lang-ja) 'append)
23221 ;; Oops, too sober. Try something to match AirCut.
23222 (set-face-font 'default "Mikachan-14"
23223 nil '(lang-ja) 'remove-tag-set-append)
23224 @end example
23225 @end itemize
23226
22975 23227
22976 @node Future Work Discussion, Old Future Work, Future Work, Top 23228 @node Future Work Discussion, Old Future Work, Future Work, Top
22977 @chapter Future Work Discussion 23229 @chapter Future Work Discussion
22978 @cindex future work, discussion 23230 @cindex future work, discussion
22979 @cindex discussion, future work 23231 @cindex discussion, future work