annotate src/fontcolor-msw.c @ 5353:38e24b8be4ea

Improve the lexical scoping in #'block, #'return-from. lisp/ChangeLog addition: 2011-02-07 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el: * bytecomp.el (byte-compile-initial-macro-environment): Shadow `block', `return-from' here, we implement them differently when byte-compiling. * bytecomp.el (byte-compile-active-blocks): New. * bytecomp.el (byte-compile-block-1): New. * bytecomp.el (byte-compile-return-from-1): New. * bytecomp.el (return-from-1): New. * bytecomp.el (block-1): New. These are two aliases that exist to have their own associated byte-compile functions, which functions implement `block' and `return-from'. * cl-extra.el (cl-macroexpand-all): Fix a bug here when macros in the environment have been compiled. * cl-macs.el (block): * cl-macs.el (return): * cl-macs.el (return-from): Be more careful about lexical scope in these macros. * cl.el: * cl.el ('cl-block-wrapper): Removed. * cl.el ('cl-block-throw): Removed. These aren't needed in code generated by this XEmacs. They shouldn't be needed in code generated by XEmacs 21.4, but if it turns out the packages do need them, we can put them back. 2011-01-30 Mike Sperber <mike@xemacs.org> * font-lock.el (font-lock-fontify-pending-extents): Don't fail if `font-lock-mode' is unset, which can happen in the middle of `revert-buffer'. 2011-01-23 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete): * cl-macs.el (delq): * cl-macs.el (remove): * cl-macs.el (remq): Don't use the compiler macro if these functions were given the wrong number of arguments, as happens in lisp-tests.el. * cl-seq.el (remove, remq): Removed. I added these to subr.el, and forgot to remove them from here. 2011-01-22 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-setq, byte-compile-set): Remove kludge allowing keywords' values to be set, all the code that does that is gone. * cl-compat.el (elt-satisfies-test-p): * faces.el (set-face-parent): * faces.el (face-doc-string): * gtk-font-menu.el: * gtk-font-menu.el (gtk-reset-device-font-menus): * msw-font-menu.el: * msw-font-menu.el (mswindows-reset-device-font-menus): * package-get.el (package-get-installedp): * select.el (select-convert-from-image-data): * sound.el: * sound.el (load-sound-file): * x-font-menu.el (x-reset-device-font-menus-core): Don't quote keywords, they're self-quoting, and the win from backward-compatibility is sufficiently small now that the style problem overrides it. 2011-01-22 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (block, return-from): Require that NAME be a symbol in these macros, as always documented in the #'block docstring and as required by Common Lisp. * descr-text.el (unidata-initialize-unihan-database): Correct the use of non-symbols in #'block and #'return-from in this function. 2011-01-15 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (concatenate): Accept more complicated TYPEs in this function, handing the sequences over to #'coerce if we don't understand them here. * cl-macs.el (inline): Don't proclaim #'concatenate as inline, its compiler macro is more useful than doing that. 2011-01-11 Aidan Kehoe <kehoea@parhasard.net> * subr.el (delete, delq, remove, remq): Move #'remove, #'remq here, they don't belong in cl-seq.el; move #'delete, #'delq here from fns.c, implement them in terms of #'delete*, allowing support for sequences generally. * update-elc.el (do-autoload-commands): Use #'delete*, not #'delq here, now the latter's no longer dumped. * cl-macs.el (delete, delq): Add compiler macros transforming #'delete and #'delq to #'delete* calls. 2011-01-10 Aidan Kehoe <kehoea@parhasard.net> * dialog.el (make-dialog-box): Correct a misplaced parenthesis here, thank you Mats Lidell in 87zkr9gqrh.fsf@mail.contactor.se ! 2011-01-02 Aidan Kehoe <kehoea@parhasard.net> * dialog.el (make-dialog-box): * list-mode.el (display-completion-list): These functions used to use cl-parsing-keywords; change them to use defun* instead, fixing the build. (Not sure what led to me not including this change in d1b17a33450b!) 2011-01-02 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (define-star-compiler-macros): Make sure the form has ITEM and LIST specified before attempting to change to calls with explicit tests; necessary for some tests in lisp-tests.el to compile correctly. (stable-union, stable-intersection): Add compiler macros for these functions, in the same way we do for most of the other functions in cl-seq.el. 2011-01-01 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (dolist, dotimes, do-symbols, macrolet) (symbol-macrolet): Define these macros with defmacro* instead of parsing the argument list by hand, for the sake of style and readability; use backquote where appropriate, instead of calling #'list and and friends, for the same reason. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * x-misc.el (device-x-display): Provide this function, documented in the Lispref for years, but not existing previously. Thank you Julian Bradfield, thank you Jeff Mincy. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl-seq.el: Move the heavy lifting from this file to C. Dump the cl-parsing-keywords macro, but don't use defun* for the functions we define that do take keywords, dynamic scope lossage makes that not practical. * subr.el (sort, fillarray): Move these aliases here. (map-plist): #'nsublis is now built-in, but at this point #'eql isn't necessarily available as a test; use #'eq. * obsolete.el (cl-delete-duplicates): Make this available for old compiler macros and old code. (memql): Document that this is equivalent to #'member*, and worse. * cl.el (adjoin, subst): Removed. These are in C. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * simple.el (assoc-ignore-case): Remove a duplicate definition of this function (it's already in subr.el). * iso8859-1.el (char-width): On non-Mule, make this function equivalent to that produced by (constantly 1), but preserve its docstring. * subr.el (subst-char-in-string): Define this in terms of #'substitute, #'nsubstitute. (string-width): Define this using #'reduce and #'char-width. (char-width): Give this a simpler definition, it makes far more sense to check for mule at load time and redefine, as we do in iso8859-1.el. (store-substring): Implement this in terms of #'replace, now #'replace is cheap. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * update-elc.el (lisp-files-needed-for-byte-compilation) (lisp-files-needing-early-byte-compilation): cl-macs belongs in the former, not the latter, it is as fundamental as bytecomp.el. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl.el: Provde the Common Lisp program-error, type-error as error symbols. This doesn't nearly go far enough for anyone using the Common Lisp errors. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete-duplicates): If the form has an incorrect number of arguments, don't attempt a compiler macroexpansion. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (cl-safe-expr-p): Forms that start with the symbol lambda are also safe. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (= < > <= >=): For these functions' compiler macros, the optimisation is safe even if the first and the last arguments have side effects, since they're only used the once. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (inline-side-effect-free-compiler-macros): Unroll a loop here at macro-expansion time, so these compiler macros are compiled. Use #'eql instead of #'eq in a couple of places for better style. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (notany, notevery): Avoid some dynamic scope stupidity with local variable names in these functions, when they weren't prefixed with cl-; go into some more detail in the doc strings. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (side-effect-free-fns): #'remove, #'remq are free of side-effects. (side-effect-and-error-free-fns): Drop dot, dot-marker from the list. 2010-11-17 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (coerce): In the argument list, name the first argument OBJECT, not X; the former name was always used in the doc string and is clearer. Handle vector type specifications which include the length of the target sequence, error if there's a mismatch. * cl-macs.el (cl-make-type-test): Handle type specifications starting with the symbol 'eql. 2010-11-14 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (eql): Don't remove the byte-compile property of this symbol. That was necessary to override a bug in bytecomp.el where #'eql was confused with #'eq, which bug we no longer have. If neither expression is constant, don't attempt to handle the expression in this compiler macro, leave it to byte-compile-eql, which produces better code anyway. * bytecomp.el (eq): #'eql is not the function associated with the byte-eq byte code. (byte-compile-eql): Add an explicit compile method for this function, for cases where the cl-macs compiler macro hasn't reduced it to #'eq or #'equal. 2010-10-25 Aidan Kehoe <kehoea@parhasard.net> Add compiler macros and compilation sanity-checking for various functions that take keywords. * byte-optimize.el (side-effect-free-fns): #'symbol-value is side-effect free and not error free. * bytecomp.el (byte-compile-normal-call): Check keyword argument lists for sanity; store information about the positions where keyword arguments start using the new byte-compile-keyword-start property. * cl-macs.el (cl-const-expr-val): Take a new optional argument, cl-not-constant, defaulting to nil, in this function; return it if the expression is not constant. (cl-non-fixnum-number-p): Make this into a separate function, we want to pass it to #'every. (eql): Use it. (define-star-compiler-macros): Use the same code to generate the member*, assoc* and rassoc* compiler macros; special-case some code in #'add-to-list in subr.el. (remove, remq): Add compiler macros for these two functions, in preparation for #'remove being in C. (define-foo-if-compiler-macros): Transform (remove-if-not ...) calls to (remove ... :if-not) at compile time, which will be a real win once the latter is in C. (define-substitute-if-compiler-macros) (define-subst-if-compiler-macros): Similarly for these functions. (delete-duplicates): Change this compiler macro to use #'plists-equal; if we don't have information about the type of SEQUENCE at compile time, don't bother attempting to inline the call, the function will be in C soon enough. (equalp): Remove an old commented-out compiler macro for this, if we want to see it it's in version control. (subst-char-in-string): Transform this to a call to nsubstitute or nsubstitute, if that is appropriate. * cl.el (ldiff): Don't call setf here, this makes for a load-time dependency problem in cl-macs.el 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * term/vt100.el: Refer to XEmacs, not GNU Emacs, in permissions. * term/bg-mouse.el: * term/sup-mouse.el: Put copyright notice in canonical "Copyright DATE AUTHOR" form. Refer to XEmacs, not GNU Emacs, in permissions. * site-load.el: Add permission boilerplate. * mule/canna-leim.el: * alist.el: Refer to XEmacs, not APEL/this program, in permissions. * mule/canna-leim.el: Remove my copyright, I've assigned it to the FSF. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * gtk.el: * gtk-widget-accessors.el: * gtk-package.el: * gtk-marshal.el: * gtk-compose.el: * gnome.el: Add copyright notice based on internal evidence. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * easymenu.el: Add reference to COPYING to permission notice. * gutter.el: * gutter-items.el: * menubar-items.el: Fix typo "Xmacs" in permissions notice. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * auto-save.el: * font.el: * fontconfig.el: * mule/kinsoku.el: Add "part of XEmacs" text to permission notice. 2010-10-14 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (side-effect-free-fns): * cl-macs.el (remf, getf): * cl-extra.el (tailp, cl-set-getf, cl-do-remf): * cl.el (ldiff, endp): Tighten up Common Lisp compatibility for #'ldiff, #'endp, #'tailp; add circularity checking for the first two. #'cl-set-getf and #'cl-do-remf were Lisp implementations of #'plist-put and #'plist-remprop; change the names to aliases, changes the macros that use them to using #'plist-put and #'plist-remprop directly. 2010-10-12 Aidan Kehoe <kehoea@parhasard.net> * abbrev.el (fundamental-mode-abbrev-table, global-abbrev-table): Create both these abbrev tables using the usual #'define-abbrev-table calls, rather than attempting to special-case them. * cl-extra.el: Force cl-macs to be loaded here, if cl-extra.el is being loaded interpreted. Previously other, later files would redundantly call (load "cl-macs") when interpreted, it's more reasonable to do it here, once. * cmdloop.el (read-quoted-char-radix): Use defcustom here, we don't have any dump-order dependencies that would prevent that. * custom.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling, rely on cl-extra.el in the former case and the appropriate entry in bytecomp-load-hook in the latter. Get rid of custom-declare-variable-list, we have no dump-time dependencies that would require it. * faces.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling. * packages.el: Remove some inaccurate comments. * post-gc.el (cleanup-simple-finalizers): Use #'delete-if-not here, now the order of preloaded-file-list has been changed to make it available. * subr.el (custom-declare-variable-list): Remove. No need for it. Also remove a stub define-abbrev-table from this file, given the current order of preloaded-file-list there's no need for it. 2010-10-10 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are also constant. (byte-compile-initial-macro-environment): In #'the, if FORM is constant and does not match TYPE, warn at byte-compile time. 2010-10-10 Aidan Kehoe <kehoea@parhasard.net> * backquote.el (bq-vector-contents, bq-list*): Remove; the former is equivalent to (append VECTOR nil), the latter to (list* ...). (bq-process-2): Use (append VECTOR nil) instead of using #'bq-vector-contents to convert to a list. (bq-process-1): Now we use list* instead of bq-list * subr.el (list*): Moved from cl.el, since it is now required to be available the first time a backquoted form is encountered. * cl.el (list*): Move to subr.el. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * test-harness.el (Check-Message): Add an omitted comma here, thank you the buildbot. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * hash-table.el (hash-table-key-list, hash-table-value-list) (hash-table-key-value-alist, hash-table-key-value-plist): Remove some useless #'nreverse calls in these files; our hash tables have no order, it's not helpful to pretend they do. * behavior.el (read-behavior): Do the same in this file, in some code evidently copied from hash-table.el. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * info.el (Info-insert-dir): * format.el (format-deannotate-region): * files.el (cd, save-buffers-kill-emacs): Use #'some, #'every and related functions for applying boolean operations to lists, instead of rolling our own ones that cons and don't short-circuit. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-initial-macro-environment): * cl-macs.el (the): Rephrase the docstring, make its implementation when compiling files a little nicer. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * descr-text.el (unidata-initialize-unicodedata-database) (unidata-initialize-unihan-database, describe-char-unicode-data) (describe-char-unicode-data): Wrap calls to the database functions with (with-fboundp ...), avoiding byte compile warnings on builds without support for the database functions. (describe-char): (reduce #'max ...), not (apply #'max ...), no need to cons needlessly. (describe-char): Remove a redundant lambda wrapping #'extent-properties. (describe-char-unicode-data): Call #'nsubst when replacing "" with nil in the result of #'split-string, instead of consing inside mapcar. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * x-faces.el (x-available-font-sizes): * specifier.el (let-specifier): * package-ui.el (pui-add-required-packages): * msw-faces.el (mswindows-available-font-sizes): * modeline.el (modeline-minor-mode-menu): * minibuf.el (minibuf-directory-files): Replace the O2N (delq nil (mapcar (lambda (W) (and X Y)) Z)) with the ON (mapcan (lambda (W) (and X (list Y))) Z) in these files. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (= < > <= >=): When these functions are handed more than two arguments, and those arguments have no side effects, transform to a series of two argument calls, avoiding funcall in the byte-compiled code. * mule/mule-cmds.el (finish-set-language-environment): Take advantage of this change in a function called 256 times at startup. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-function-form, byte-compile-quote) (byte-compile-quote-form): Warn at compile time, and error at runtime, if a (quote ...) or a (function ...) form attempts to quote more than one object. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (byte-optimize-apply): Transform (apply 'nconc (mapcar ...)) to (mapcan ...); warn about use of the first idiom. * update-elc.el (do-autoload-commands): * packages.el (packages-find-package-library-path): * frame.el (frame-list): * extents.el (extent-descendants): * etags.el (buffer-tag-table-files): * dumped-lisp.el (preloaded-file-list): * device.el (device-list): * bytecomp-runtime.el (proclaim-inline, proclaim-notinline) Use #'mapcan, not (apply #'nconc (mapcar ...) in all these files. * bytecomp-runtime.el (eval-when-compile, eval-and-compile): In passing, mention that these macros also evaluate the body when interpreted. tests/ChangeLog addition: 2011-02-07 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test lexical scope for `block', `return-from'; add a Known-Bug-Expect-Failure for a contorted example that fails when byte-compiled.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 07 Feb 2011 12:01:24 +0000
parents 94bbd4792049
children 0af042a0c116
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* mswindows-specific Lisp objects.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995 Tinker Systems.
5015
d95c102a96d3 cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents: 4982
diff changeset
5 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004, 2005, 2010 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 Copyright (C) 1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 Copyright (C) 1997 Jonathan Harris.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 /* Authorship:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
5015
d95c102a96d3 cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents: 4982
diff changeset
30 This file created by Jonathan Harris, November 1997 for 21.0; based
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 5024
diff changeset
31 heavily on fontcolor-x.c (see authorship there). Much further work
5015
d95c102a96d3 cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents: 4982
diff changeset
32 by Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
35 /* This function Mule-ized by Ben Wing, 3-24-02. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 /* TODO: palette handling */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
42 #include "console-msw-impl.h"
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 5024
diff changeset
43 #include "fontcolor-msw-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
44
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #include "buffer.h"
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
46 #include "charset.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
47 #include "device-impl.h"
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
48 #include "elhash.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #include "insdel.h"
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
50 #include "opaque.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
52 typedef struct colormap_t
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
54 const Ascbyte *name;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
55 COLORREF colorref;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 } colormap_t;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 /* Colors from X11R6 "XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp" */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
59 /* MSWindows tends to round up the numbers in its palette, ie where X uses
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60 * 127, MSWindows uses 128. Colors commented as "Adjusted" are tweaked to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
61 * match the Windows standard palette to increase the likelihood of
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
62 * mswindows_color_to_string() finding a named match.
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
63
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
64 Sorted case-insensitively by the string name of the color.
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
65
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
66 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
67 static const colormap_t mswindows_X_color_map[] =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 {
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
69 {"AliceBlue" , PALETTERGB (240, 248, 255) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
70 {"AntiqueWhite" , PALETTERGB (250, 235, 215) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
71 {"AntiqueWhite1" , PALETTERGB (255, 239, 219) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
72 {"AntiqueWhite2" , PALETTERGB (238, 223, 204) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
73 {"AntiqueWhite3" , PALETTERGB (205, 192, 176) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
74 {"AntiqueWhite4" , PALETTERGB (139, 131, 120) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
75 {"aquamarine" , PALETTERGB (127, 255, 212) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
76 {"aquamarine1" , PALETTERGB (127, 255, 212) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
77 {"aquamarine2" , PALETTERGB (118, 238, 198) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
78 {"aquamarine3" , PALETTERGB (102, 205, 170) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
79 {"aquamarine4" , PALETTERGB (69, 139, 116) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
80 {"azure" , PALETTERGB (240, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
81 {"azure1" , PALETTERGB (240, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
82 {"azure2" , PALETTERGB (224, 238, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
83 {"azure3" , PALETTERGB (193, 205, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
84 {"azure4" , PALETTERGB (131, 139, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
85 {"beige" , PALETTERGB (245, 245, 220) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
86 {"bisque" , PALETTERGB (255, 228, 196) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
87 {"bisque1" , PALETTERGB (255, 228, 196) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
88 {"bisque2" , PALETTERGB (238, 213, 183) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
89 {"bisque3" , PALETTERGB (205, 183, 158) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
90 {"bisque4" , PALETTERGB (139, 125, 107) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
91 {"black" , PALETTERGB (0, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
92 {"BlanchedAlmond" , PALETTERGB (255, 235, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
93 {"blue" , PALETTERGB (0, 0, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
94 {"blue1" , PALETTERGB (0, 0, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
95 {"blue2" , PALETTERGB (0, 0, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
96 {"blue3" , PALETTERGB (0, 0, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
97 {"blue4" , PALETTERGB (0, 0, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
98 {"BlueViolet" , PALETTERGB (138, 43, 226) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
99 {"brown" , PALETTERGB (165, 42, 42) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
100 {"brown1" , PALETTERGB (255, 64, 64) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
101 {"brown2" , PALETTERGB (238, 59, 59) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
102 {"brown3" , PALETTERGB (205, 51, 51) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
103 {"brown4" , PALETTERGB (139, 35, 35) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
104 {"burlywood" , PALETTERGB (222, 184, 135) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
105 {"burlywood1" , PALETTERGB (255, 211, 155) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
106 {"burlywood2" , PALETTERGB (238, 197, 145) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
107 {"burlywood3" , PALETTERGB (205, 170, 125) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
108 {"burlywood4" , PALETTERGB (139, 115, 85) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
109 {"CadetBlue" , PALETTERGB (95, 158, 160) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
110 {"CadetBlue1" , PALETTERGB (152, 245, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
111 {"CadetBlue2" , PALETTERGB (144, 220, 240) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
112 {"CadetBlue3" , PALETTERGB (122, 197, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
113 {"CadetBlue4" , PALETTERGB (83, 134, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
114 {"chartreuse" , PALETTERGB (127, 255, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
115 {"chartreuse1" , PALETTERGB (127, 255, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
116 {"chartreuse2" , PALETTERGB (118, 238, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
117 {"chartreuse3" , PALETTERGB (102, 205, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
118 {"chartreuse4" , PALETTERGB (69, 139, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
119 {"chocolate" , PALETTERGB (210, 105, 30) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
120 {"chocolate1" , PALETTERGB (255, 127, 36) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
121 {"chocolate2" , PALETTERGB (238, 118, 33) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
122 {"chocolate3" , PALETTERGB (205, 102, 29) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
123 {"chocolate4" , PALETTERGB (139, 69, 19) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
124 {"coral" , PALETTERGB (255, 127, 80) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
125 {"coral1" , PALETTERGB (255, 114, 86) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
126 {"coral2" , PALETTERGB (238, 106, 80) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
127 {"coral3" , PALETTERGB (205, 91, 69) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
128 {"coral4" , PALETTERGB (139, 62, 47) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
129 {"CornflowerBlue" , PALETTERGB (100, 149, 237) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
130 {"cornsilk" , PALETTERGB (255, 248, 220) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
131 {"cornsilk1" , PALETTERGB (255, 248, 220) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
132 {"cornsilk2" , PALETTERGB (238, 232, 205) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
133 {"cornsilk3" , PALETTERGB (205, 200, 177) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
134 {"cornsilk4" , PALETTERGB (139, 136, 120) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
135 {"cyan" , PALETTERGB (0, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
136 {"cyan1" , PALETTERGB (0, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
137 {"cyan2" , PALETTERGB (0, 238, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
138 {"cyan3" , PALETTERGB (0, 205, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
139 {"cyan4" , PALETTERGB (0, 139, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
140 {"DarkBlue" , PALETTERGB (0, 0, 128) }, /* Adjusted == Navy */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
141 {"DarkCyan" , PALETTERGB (0, 128, 128) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
142 {"DarkGoldenrod" , PALETTERGB (184, 134, 11) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
143 {"DarkGoldenrod1" , PALETTERGB (255, 185, 15) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
144 {"DarkGoldenrod2" , PALETTERGB (238, 173, 14) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
145 {"DarkGoldenrod3" , PALETTERGB (205, 149, 12) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
146 {"DarkGoldenrod4" , PALETTERGB (139, 101, 8) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
147 {"DarkGray" , PALETTERGB (169, 169, 169) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
148 {"DarkGreen" , PALETTERGB (0, 128, 0) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
149 {"DarkGrey" , PALETTERGB (169, 169, 169) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
150 {"DarkKhaki" , PALETTERGB (189, 183, 107) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
151 {"DarkMagenta" , PALETTERGB (128, 0, 128) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
152 {"DarkOliveGreen" , PALETTERGB (85, 107, 47) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
153 {"DarkOliveGreen1" , PALETTERGB (202, 255, 112) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
154 {"DarkOliveGreen2" , PALETTERGB (188, 238, 104) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
155 {"DarkOliveGreen3" , PALETTERGB (162, 205, 90) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
156 {"DarkOliveGreen4" , PALETTERGB (110, 139, 61) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
157 {"DarkOrange" , PALETTERGB (255, 140, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
158 {"DarkOrange1" , PALETTERGB (255, 127, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
159 {"DarkOrange2" , PALETTERGB (238, 118, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
160 {"DarkOrange3" , PALETTERGB (205, 102, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
161 {"DarkOrange4" , PALETTERGB (139, 69, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
162 {"DarkOrchid" , PALETTERGB (153, 50, 204) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
163 {"DarkOrchid1" , PALETTERGB (191, 62, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
164 {"DarkOrchid2" , PALETTERGB (178, 58, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
165 {"DarkOrchid3" , PALETTERGB (154, 50, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
166 {"DarkOrchid4" , PALETTERGB (104, 34, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
167 {"DarkRed" , PALETTERGB (128, 0, 0) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
168 {"DarkSalmon" , PALETTERGB (233, 150, 122) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
169 {"DarkSeaGreen" , PALETTERGB (143, 188, 143) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
170 {"DarkSeaGreen1" , PALETTERGB (193, 255, 193) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
171 {"DarkSeaGreen2" , PALETTERGB (180, 238, 180) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
172 {"DarkSeaGreen3" , PALETTERGB (155, 205, 155) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
173 {"DarkSeaGreen4" , PALETTERGB (105, 139, 105) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
174 {"DarkSlateBlue" , PALETTERGB (72, 61, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
175 {"DarkSlateGray" , PALETTERGB (47, 79, 79) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
176 {"DarkSlateGray1" , PALETTERGB (151, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
177 {"DarkSlateGray2" , PALETTERGB (141, 238, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
178 {"DarkSlateGray3" , PALETTERGB (121, 205, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
179 {"DarkSlateGray4" , PALETTERGB (82, 139, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
180 {"DarkSlateGrey" , PALETTERGB (47, 79, 79) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
181 {"DarkTurquoise" , PALETTERGB (0, 206, 209) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
182 {"DarkViolet" , PALETTERGB (148, 0, 211) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
183 {"DarkYellow" , PALETTERGB (128, 128, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
184 {"DeepPink" , PALETTERGB (255, 20, 147) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
185 {"DeepPink1" , PALETTERGB (255, 20, 147) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
186 {"DeepPink2" , PALETTERGB (238, 18, 137) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
187 {"DeepPink3" , PALETTERGB (205, 16, 118) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
188 {"DeepPink4" , PALETTERGB (139, 10, 80) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
189 {"DeepSkyBlue" , PALETTERGB (0, 191, 255) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
190 {"DeepSkyBlue1" , PALETTERGB (0, 191, 255) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
191 {"DeepSkyBlue2" , PALETTERGB (0, 178, 238) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
192 {"DeepSkyBlue3" , PALETTERGB (0, 154, 205) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
193 {"DeepSkyBlue4" , PALETTERGB (0, 104, 139) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
194 {"DimGray" , PALETTERGB (105, 105, 105) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
195 {"DimGrey" , PALETTERGB (105, 105, 105) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
196 {"DodgerBlue" , PALETTERGB (30, 144, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
197 {"DodgerBlue1" , PALETTERGB (30, 144, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
198 {"DodgerBlue2" , PALETTERGB (28, 134, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
199 {"DodgerBlue3" , PALETTERGB (24, 116, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
200 {"DodgerBlue4" , PALETTERGB (16, 78, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
201 {"firebrick" , PALETTERGB (178, 34, 34) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
202 {"firebrick1" , PALETTERGB (255, 48, 48) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
203 {"firebrick2" , PALETTERGB (238, 44, 44) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
204 {"firebrick3" , PALETTERGB (205, 38, 38) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
205 {"firebrick4" , PALETTERGB (139, 26, 26) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
206 {"FloralWhite" , PALETTERGB (255, 250, 240) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
207 {"ForestGreen" , PALETTERGB (34, 139, 34) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
208 {"gainsboro" , PALETTERGB (220, 220, 220) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
209 {"GhostWhite" , PALETTERGB (248, 248, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
210 {"gold" , PALETTERGB (255, 215, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
211 {"gold1" , PALETTERGB (255, 215, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
212 {"gold2" , PALETTERGB (238, 201, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
213 {"gold3" , PALETTERGB (205, 173, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
214 {"gold4" , PALETTERGB (139, 117, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
215 {"goldenrod" , PALETTERGB (218, 165, 32) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
216 {"goldenrod1" , PALETTERGB (255, 193, 37) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
217 {"goldenrod2" , PALETTERGB (238, 180, 34) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
218 {"goldenrod3" , PALETTERGB (205, 155, 29) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
219 {"goldenrod4" , PALETTERGB (139, 105, 20) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
220 {"gray" , PALETTERGB (190, 190, 190) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
221 {"gray0" , PALETTERGB (0, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
222 {"gray1" , PALETTERGB (3, 3, 3) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
223 {"gray10" , PALETTERGB (26, 26, 26) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
224 {"gray100" , PALETTERGB (255, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
225 {"gray11" , PALETTERGB (28, 28, 28) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
226 {"gray12" , PALETTERGB (31, 31, 31) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
227 {"gray13" , PALETTERGB (33, 33, 33) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
228 {"gray14" , PALETTERGB (36, 36, 36) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
229 {"gray15" , PALETTERGB (38, 38, 38) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
230 {"gray16" , PALETTERGB (41, 41, 41) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
231 {"gray17" , PALETTERGB (43, 43, 43) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
232 {"gray18" , PALETTERGB (46, 46, 46) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
233 {"gray19" , PALETTERGB (48, 48, 48) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
234 {"gray2" , PALETTERGB (5, 5, 5) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
235 {"gray20" , PALETTERGB (51, 51, 51) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
236 {"gray21" , PALETTERGB (54, 54, 54) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
237 {"gray22" , PALETTERGB (56, 56, 56) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
238 {"gray23" , PALETTERGB (59, 59, 59) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
239 {"gray24" , PALETTERGB (61, 61, 61) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
240 {"gray25" , PALETTERGB (64, 64, 64) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
241 {"gray26" , PALETTERGB (66, 66, 66) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
242 {"gray27" , PALETTERGB (69, 69, 69) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
243 {"gray28" , PALETTERGB (71, 71, 71) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
244 {"gray29" , PALETTERGB (74, 74, 74) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
245 {"gray3" , PALETTERGB (8, 8, 8) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
246 {"gray30" , PALETTERGB (77, 77, 77) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
247 {"gray31" , PALETTERGB (79, 79, 79) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
248 {"gray32" , PALETTERGB (82, 82, 82) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
249 {"gray33" , PALETTERGB (84, 84, 84) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
250 {"gray34" , PALETTERGB (87, 87, 87) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
251 {"gray35" , PALETTERGB (89, 89, 89) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
252 {"gray36" , PALETTERGB (92, 92, 92) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
253 {"gray37" , PALETTERGB (94, 94, 94) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
254 {"gray38" , PALETTERGB (97, 97, 97) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
255 {"gray39" , PALETTERGB (99, 99, 99) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
256 {"gray4" , PALETTERGB (10, 10, 10) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
257 {"gray40" , PALETTERGB (102, 102, 102) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
258 {"gray41" , PALETTERGB (105, 105, 105) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
259 {"gray42" , PALETTERGB (107, 107, 107) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
260 {"gray43" , PALETTERGB (110, 110, 110) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
261 {"gray44" , PALETTERGB (112, 112, 112) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
262 {"gray45" , PALETTERGB (115, 115, 115) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
263 {"gray46" , PALETTERGB (117, 117, 117) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
264 {"gray47" , PALETTERGB (120, 120, 120) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
265 {"gray48" , PALETTERGB (122, 122, 122) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
266 {"gray49" , PALETTERGB (125, 125, 125) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
267 {"gray5" , PALETTERGB (13, 13, 13) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
268 {"gray50" , PALETTERGB (128, 128, 128) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
269 {"gray51" , PALETTERGB (130, 130, 130) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
270 {"gray52" , PALETTERGB (133, 133, 133) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
271 {"gray53" , PALETTERGB (135, 135, 135) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
272 {"gray54" , PALETTERGB (138, 138, 138) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
273 {"gray55" , PALETTERGB (140, 140, 140) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
274 {"gray56" , PALETTERGB (143, 143, 143) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
275 {"gray57" , PALETTERGB (145, 145, 145) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
276 {"gray58" , PALETTERGB (148, 148, 148) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
277 {"gray59" , PALETTERGB (150, 150, 150) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
278 {"gray6" , PALETTERGB (15, 15, 15) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
279 {"gray60" , PALETTERGB (153, 153, 153) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
280 {"gray61" , PALETTERGB (156, 156, 156) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
281 {"gray62" , PALETTERGB (158, 158, 158) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
282 {"gray63" , PALETTERGB (161, 161, 161) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
283 {"gray64" , PALETTERGB (163, 163, 163) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
284 {"gray65" , PALETTERGB (166, 166, 166) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
285 {"gray66" , PALETTERGB (168, 168, 168) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
286 {"gray67" , PALETTERGB (171, 171, 171) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
287 {"gray68" , PALETTERGB (173, 173, 173) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
288 {"gray69" , PALETTERGB (176, 176, 176) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
289 {"gray7" , PALETTERGB (18, 18, 18) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
290 {"gray70" , PALETTERGB (179, 179, 179) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
291 {"gray71" , PALETTERGB (181, 181, 181) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
292 {"gray72" , PALETTERGB (184, 184, 184) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
293 {"gray73" , PALETTERGB (186, 186, 186) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
294 {"gray74" , PALETTERGB (189, 189, 189) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
295 {"gray75" , PALETTERGB (192, 192, 192) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
296 {"gray76" , PALETTERGB (194, 194, 194) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
297 {"gray77" , PALETTERGB (196, 196, 196) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
298 {"gray78" , PALETTERGB (199, 199, 199) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
299 {"gray79" , PALETTERGB (201, 201, 201) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
300 {"gray8" , PALETTERGB (20, 20, 20) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
301 {"gray80" , PALETTERGB (204, 204, 204) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
302 {"gray81" , PALETTERGB (207, 207, 207) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
303 {"gray82" , PALETTERGB (209, 209, 209) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
304 {"gray83" , PALETTERGB (212, 212, 212) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
305 {"gray84" , PALETTERGB (214, 214, 214) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
306 {"gray85" , PALETTERGB (217, 217, 217) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
307 {"gray86" , PALETTERGB (219, 219, 219) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
308 {"gray87" , PALETTERGB (222, 222, 222) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
309 {"gray88" , PALETTERGB (224, 224, 224) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
310 {"gray89" , PALETTERGB (227, 227, 227) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
311 {"gray9" , PALETTERGB (23, 23, 23) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
312 {"gray90" , PALETTERGB (229, 229, 229) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
313 {"gray91" , PALETTERGB (232, 232, 232) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
314 {"gray92" , PALETTERGB (235, 235, 235) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
315 {"gray93" , PALETTERGB (237, 237, 237) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
316 {"gray94" , PALETTERGB (240, 240, 240) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
317 {"gray95" , PALETTERGB (242, 242, 242) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
318 {"gray96" , PALETTERGB (245, 245, 245) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
319 {"gray97" , PALETTERGB (247, 247, 247) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
320 {"gray98" , PALETTERGB (250, 250, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
321 {"gray99" , PALETTERGB (252, 252, 252) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
322 {"green" , PALETTERGB (0, 255, 0) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
323 {"green1" , PALETTERGB (0, 255, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
324 {"green2" , PALETTERGB (0, 238, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
325 {"green3" , PALETTERGB (0, 205, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
326 {"green4" , PALETTERGB (0, 139, 0) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
327 {"GreenYellow" , PALETTERGB (173, 255, 47) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
328 {"grey" , PALETTERGB (190, 190, 190) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
329 {"grey0" , PALETTERGB (0, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
330 {"grey1" , PALETTERGB (3, 3, 3) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
331 {"grey10" , PALETTERGB (26, 26, 26) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
332 {"grey100" , PALETTERGB (255, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
333 {"grey11" , PALETTERGB (28, 28, 28) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
334 {"grey12" , PALETTERGB (31, 31, 31) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
335 {"grey13" , PALETTERGB (33, 33, 33) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
336 {"grey14" , PALETTERGB (36, 36, 36) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
337 {"grey15" , PALETTERGB (38, 38, 38) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
338 {"grey16" , PALETTERGB (41, 41, 41) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
339 {"grey17" , PALETTERGB (43, 43, 43) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
340 {"grey18" , PALETTERGB (46, 46, 46) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
341 {"grey19" , PALETTERGB (48, 48, 48) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
342 {"grey2" , PALETTERGB (5, 5, 5) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
343 {"grey20" , PALETTERGB (51, 51, 51) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
344 {"grey21" , PALETTERGB (54, 54, 54) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
345 {"grey22" , PALETTERGB (56, 56, 56) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
346 {"grey23" , PALETTERGB (59, 59, 59) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
347 {"grey24" , PALETTERGB (61, 61, 61) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
348 {"grey25" , PALETTERGB (64, 64, 64) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
349 {"grey26" , PALETTERGB (66, 66, 66) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
350 {"grey27" , PALETTERGB (69, 69, 69) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
351 {"grey28" , PALETTERGB (71, 71, 71) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
352 {"grey29" , PALETTERGB (74, 74, 74) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
353 {"grey3" , PALETTERGB (8, 8, 8) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
354 {"grey30" , PALETTERGB (77, 77, 77) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
355 {"grey31" , PALETTERGB (79, 79, 79) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
356 {"grey32" , PALETTERGB (82, 82, 82) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
357 {"grey33" , PALETTERGB (84, 84, 84) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
358 {"grey34" , PALETTERGB (87, 87, 87) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
359 {"grey35" , PALETTERGB (89, 89, 89) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
360 {"grey36" , PALETTERGB (92, 92, 92) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
361 {"grey37" , PALETTERGB (94, 94, 94) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
362 {"grey38" , PALETTERGB (97, 97, 97) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
363 {"grey39" , PALETTERGB (99, 99, 99) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
364 {"grey4" , PALETTERGB (10, 10, 10) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
365 {"grey40" , PALETTERGB (102, 102, 102) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
366 {"grey41" , PALETTERGB (105, 105, 105) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
367 {"grey42" , PALETTERGB (107, 107, 107) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
368 {"grey43" , PALETTERGB (110, 110, 110) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
369 {"grey44" , PALETTERGB (112, 112, 112) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
370 {"grey45" , PALETTERGB (115, 115, 115) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
371 {"grey46" , PALETTERGB (117, 117, 117) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
372 {"grey47" , PALETTERGB (120, 120, 120) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
373 {"grey48" , PALETTERGB (122, 122, 122) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
374 {"grey49" , PALETTERGB (125, 125, 125) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
375 {"grey5" , PALETTERGB (13, 13, 13) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
376 {"grey50" , PALETTERGB (128, 128, 128) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
377 {"grey51" , PALETTERGB (130, 130, 130) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
378 {"grey52" , PALETTERGB (133, 133, 133) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
379 {"grey53" , PALETTERGB (135, 135, 135) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
380 {"grey54" , PALETTERGB (138, 138, 138) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
381 {"grey55" , PALETTERGB (140, 140, 140) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
382 {"grey56" , PALETTERGB (143, 143, 143) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
383 {"grey57" , PALETTERGB (145, 145, 145) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
384 {"grey58" , PALETTERGB (148, 148, 148) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
385 {"grey59" , PALETTERGB (150, 150, 150) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
386 {"grey6" , PALETTERGB (15, 15, 15) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
387 {"grey60" , PALETTERGB (153, 153, 153) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
388 {"grey61" , PALETTERGB (156, 156, 156) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
389 {"grey62" , PALETTERGB (158, 158, 158) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
390 {"grey63" , PALETTERGB (161, 161, 161) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
391 {"grey64" , PALETTERGB (163, 163, 163) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
392 {"grey65" , PALETTERGB (166, 166, 166) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
393 {"grey66" , PALETTERGB (168, 168, 168) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
394 {"grey67" , PALETTERGB (171, 171, 171) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
395 {"grey68" , PALETTERGB (173, 173, 173) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
396 {"grey69" , PALETTERGB (176, 176, 176) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
397 {"grey7" , PALETTERGB (18, 18, 18) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
398 {"grey70" , PALETTERGB (179, 179, 179) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
399 {"grey71" , PALETTERGB (181, 181, 181) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
400 {"grey72" , PALETTERGB (184, 184, 184) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
401 {"grey73" , PALETTERGB (186, 186, 186) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
402 {"grey74" , PALETTERGB (189, 189, 189) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
403 {"grey75" , PALETTERGB (192, 192, 192) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
404 {"grey76" , PALETTERGB (194, 194, 194) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
405 {"grey77" , PALETTERGB (196, 196, 196) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
406 {"grey78" , PALETTERGB (199, 199, 199) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
407 {"grey79" , PALETTERGB (201, 201, 201) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
408 {"grey8" , PALETTERGB (20, 20, 20) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
409 {"grey80" , PALETTERGB (204, 204, 204) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
410 {"grey81" , PALETTERGB (207, 207, 207) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
411 {"grey82" , PALETTERGB (209, 209, 209) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
412 {"grey83" , PALETTERGB (212, 212, 212) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
413 {"grey84" , PALETTERGB (214, 214, 214) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
414 {"grey85" , PALETTERGB (217, 217, 217) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
415 {"grey86" , PALETTERGB (219, 219, 219) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
416 {"grey87" , PALETTERGB (222, 222, 222) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
417 {"grey88" , PALETTERGB (224, 224, 224) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
418 {"grey89" , PALETTERGB (227, 227, 227) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
419 {"grey9" , PALETTERGB (23, 23, 23) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
420 {"grey90" , PALETTERGB (229, 229, 229) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
421 {"grey91" , PALETTERGB (232, 232, 232) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
422 {"grey92" , PALETTERGB (235, 235, 235) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
423 {"grey93" , PALETTERGB (237, 237, 237) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
424 {"grey94" , PALETTERGB (240, 240, 240) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
425 {"grey95" , PALETTERGB (242, 242, 242) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
426 {"grey96" , PALETTERGB (245, 245, 245) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
427 {"grey97" , PALETTERGB (247, 247, 247) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
428 {"grey98" , PALETTERGB (250, 250, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
429 {"grey99" , PALETTERGB (252, 252, 252) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
430 {"honeydew" , PALETTERGB (240, 255, 240) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
431 {"honeydew1" , PALETTERGB (240, 255, 240) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
432 {"honeydew2" , PALETTERGB (224, 238, 224) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
433 {"honeydew3" , PALETTERGB (193, 205, 193) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
434 {"honeydew4" , PALETTERGB (131, 139, 131) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
435 {"HotPink" , PALETTERGB (255, 105, 180) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
436 {"HotPink1" , PALETTERGB (255, 110, 180) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
437 {"HotPink2" , PALETTERGB (238, 106, 167) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
438 {"HotPink3" , PALETTERGB (205, 96, 144) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
439 {"HotPink4" , PALETTERGB (139, 58, 98) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
440 {"IndianRed" , PALETTERGB (205, 92, 92) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
441 {"IndianRed1" , PALETTERGB (255, 106, 106) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
442 {"IndianRed2" , PALETTERGB (238, 99, 99) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
443 {"IndianRed3" , PALETTERGB (205, 85, 85) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
444 {"IndianRed4" , PALETTERGB (139, 58, 58) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
445 {"ivory" , PALETTERGB (255, 255, 240) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
446 {"ivory1" , PALETTERGB (255, 255, 240) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
447 {"ivory2" , PALETTERGB (240, 240, 208) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
448 {"ivory3" , PALETTERGB (205, 205, 193) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
449 {"ivory4" , PALETTERGB (139, 139, 131) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
450 {"khaki" , PALETTERGB (240, 230, 140) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
451 {"khaki1" , PALETTERGB (255, 246, 143) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
452 {"khaki2" , PALETTERGB (238, 230, 133) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
453 {"khaki3" , PALETTERGB (205, 198, 115) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
454 {"khaki4" , PALETTERGB (139, 134, 78) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
455 {"lavender" , PALETTERGB (230, 230, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
456 {"LavenderBlush" , PALETTERGB (255, 240, 245) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
457 {"LavenderBlush1" , PALETTERGB (255, 240, 245) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
458 {"LavenderBlush2" , PALETTERGB (238, 224, 229) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
459 {"LavenderBlush3" , PALETTERGB (205, 193, 197) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
460 {"LavenderBlush4" , PALETTERGB (139, 131, 134) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
461 {"LawnGreen" , PALETTERGB (124, 252, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
462 {"LemonChiffon" , PALETTERGB (255, 250, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
463 {"LemonChiffon1" , PALETTERGB (255, 250, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
464 {"LemonChiffon2" , PALETTERGB (238, 233, 191) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
465 {"LemonChiffon3" , PALETTERGB (205, 201, 165) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
466 {"LemonChiffon4" , PALETTERGB (139, 137, 112) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
467 {"LightBlue" , PALETTERGB (173, 216, 230) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
468 {"LightBlue1" , PALETTERGB (191, 239, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
469 {"LightBlue2" , PALETTERGB (178, 223, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
470 {"LightBlue3" , PALETTERGB (154, 192, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
471 {"LightBlue4" , PALETTERGB (104, 131, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
472 {"LightCoral" , PALETTERGB (240, 128, 128) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
473 {"LightCyan" , PALETTERGB (224, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
474 {"LightCyan1" , PALETTERGB (224, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
475 {"LightCyan2" , PALETTERGB (209, 238, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
476 {"LightCyan3" , PALETTERGB (180, 205, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
477 {"LightCyan4" , PALETTERGB (122, 139, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
478 {"LightGoldenrod" , PALETTERGB (238, 221, 130) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
479 {"LightGoldenrod1" , PALETTERGB (255, 236, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
480 {"LightGoldenrod2" , PALETTERGB (238, 220, 130) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
481 {"LightGoldenrod3" , PALETTERGB (205, 190, 112) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
482 {"LightGoldenrod4" , PALETTERGB (139, 129, 76) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
483 {"LightGoldenrodYellow", PALETTERGB (250, 250, 210) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
484 {"LightGray" , PALETTERGB (211, 211, 211) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
485 {"LightGreen" , PALETTERGB (144, 238, 144) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
486 {"LightGrey" , PALETTERGB (211, 211, 211) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
487 {"LightPink" , PALETTERGB (255, 182, 193) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
488 {"LightPink1" , PALETTERGB (255, 174, 185) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
489 {"LightPink2" , PALETTERGB (238, 162, 173) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
490 {"LightPink3" , PALETTERGB (205, 140, 149) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
491 {"LightPink4" , PALETTERGB (139, 95, 101) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
492 {"LightSalmon" , PALETTERGB (255, 160, 122) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
493 {"LightSalmon1" , PALETTERGB (255, 160, 122) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
494 {"LightSalmon2" , PALETTERGB (238, 149, 114) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
495 {"LightSalmon3" , PALETTERGB (205, 129, 98) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
496 {"LightSalmon4" , PALETTERGB (139, 87, 66) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
497 {"LightSeaGreen" , PALETTERGB (32, 178, 170) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
498 {"LightSkyBlue" , PALETTERGB (135, 206, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
499 {"LightSkyBlue1" , PALETTERGB (176, 226, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
500 {"LightSkyBlue2" , PALETTERGB (164, 211, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
501 {"LightSkyBlue3" , PALETTERGB (141, 182, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
502 {"LightSkyBlue4" , PALETTERGB (96, 123, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
503 {"LightSlateBlue" , PALETTERGB (132, 112, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
504 {"LightSlateGray" , PALETTERGB (119, 136, 153) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
505 {"LightSlateGrey" , PALETTERGB (119, 136, 153) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
506 {"LightSteelBlue" , PALETTERGB (176, 196, 222) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
507 {"LightSteelBlue1" , PALETTERGB (202, 225, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
508 {"LightSteelBlue2" , PALETTERGB (188, 210, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
509 {"LightSteelBlue3" , PALETTERGB (162, 181, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
510 {"LightSteelBlue4" , PALETTERGB (110, 123, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
511 {"LightYellow" , PALETTERGB (255, 255, 224) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
512 {"LightYellow" , PALETTERGB (255, 255, 225) }, /* Adjusted */
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
513 {"LightYellow1" , PALETTERGB (255, 255, 224) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
514 {"LightYellow2" , PALETTERGB (238, 238, 209) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
515 {"LightYellow3" , PALETTERGB (205, 205, 180) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
516 {"LightYellow4" , PALETTERGB (139, 139, 122) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
517 {"LimeGreen" , PALETTERGB (50, 205, 50) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
518 {"linen" , PALETTERGB (250, 240, 230) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
519 {"magenta" , PALETTERGB (255, 0, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
520 {"magenta1" , PALETTERGB (255, 0, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
521 {"magenta2" , PALETTERGB (238, 0, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
522 {"magenta3" , PALETTERGB (205, 0, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
523 {"magenta4" , PALETTERGB (139, 0, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
524 {"maroon" , PALETTERGB (176, 48, 96) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
525 {"maroon1" , PALETTERGB (255, 52, 179) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
526 {"maroon2" , PALETTERGB (238, 48, 167) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
527 {"maroon3" , PALETTERGB (205, 41, 144) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
528 {"maroon4" , PALETTERGB (139, 28, 98) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
529 {"MediumAquamarine" , PALETTERGB (102, 205, 170) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
530 {"MediumBlue" , PALETTERGB (0, 0, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
531 {"MediumOrchid" , PALETTERGB (186, 85, 211) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
532 {"MediumOrchid1" , PALETTERGB (224, 102, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
533 {"MediumOrchid2" , PALETTERGB (209, 95, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
534 {"MediumOrchid3" , PALETTERGB (180, 82, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
535 {"MediumOrchid4" , PALETTERGB (122, 55, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
536 {"MediumPurple" , PALETTERGB (147, 112, 219) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
537 {"MediumPurple1" , PALETTERGB (171, 130, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
538 {"MediumPurple2" , PALETTERGB (159, 121, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
539 {"MediumPurple3" , PALETTERGB (137, 104, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
540 {"MediumPurple4" , PALETTERGB (93, 71, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
541 {"MediumSeaGreen" , PALETTERGB (60, 179, 113) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
542 {"MediumSlateBlue" , PALETTERGB (123, 104, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
543 {"MediumSpringGreen" , PALETTERGB (0, 250, 154) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
544 {"MediumTurquoise" , PALETTERGB (72, 209, 204) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
545 {"MediumVioletRed" , PALETTERGB (199, 21, 133) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
546 {"MidnightBlue" , PALETTERGB (25, 25, 112) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
547 {"MintCream" , PALETTERGB (245, 255, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
548 {"MistyRose" , PALETTERGB (255, 228, 225) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
549 {"MistyRose1" , PALETTERGB (255, 228, 225) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
550 {"MistyRose2" , PALETTERGB (238, 213, 210) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
551 {"MistyRose3" , PALETTERGB (205, 183, 181) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
552 {"MistyRose4" , PALETTERGB (139, 125, 123) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
553 {"moccasin" , PALETTERGB (255, 228, 181) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
554 {"NavajoWhite" , PALETTERGB (255, 222, 173) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
555 {"NavajoWhite1" , PALETTERGB (255, 222, 173) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
556 {"NavajoWhite2" , PALETTERGB (238, 207, 161) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
557 {"NavajoWhite3" , PALETTERGB (205, 179, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
558 {"NavajoWhite4" , PALETTERGB (139, 121, 94) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
559 {"navy" , PALETTERGB (0, 0, 128) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
560 {"NavyBlue" , PALETTERGB (0, 0, 128) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
561 {"OldLace" , PALETTERGB (253, 245, 230) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
562 {"OliveDrab" , PALETTERGB (107, 142, 35) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
563 {"OliveDrab1" , PALETTERGB (192, 255, 62) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
564 {"OliveDrab2" , PALETTERGB (179, 238, 58) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
565 {"OliveDrab3" , PALETTERGB (154, 205, 50) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
566 {"OliveDrab4" , PALETTERGB (105, 139, 34) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
567 {"orange" , PALETTERGB (255, 165, 0) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
568 {"orange1" , PALETTERGB (255, 165, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
569 {"orange2" , PALETTERGB (238, 154, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
570 {"orange3" , PALETTERGB (205, 133, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
571 {"orange4" , PALETTERGB (139, 90, 0) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
572 {"OrangeRed" , PALETTERGB (255, 69, 0) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
573 {"OrangeRed1" , PALETTERGB (255, 69, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
574 {"OrangeRed2" , PALETTERGB (238, 64, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
575 {"OrangeRed3" , PALETTERGB (205, 55, 0) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
576 {"OrangeRed4" , PALETTERGB (139, 37, 0) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
577 {"orchid" , PALETTERGB (218, 112, 214) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
578 {"orchid1" , PALETTERGB (255, 131, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
579 {"orchid2" , PALETTERGB (238, 122, 233) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
580 {"orchid3" , PALETTERGB (205, 105, 201) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
581 {"orchid4" , PALETTERGB (139, 71, 137) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
582 {"PaleGoldenrod" , PALETTERGB (238, 232, 170) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
583 {"PaleGreen" , PALETTERGB (152, 251, 152) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
584 {"PaleGreen1" , PALETTERGB (154, 255, 154) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
585 {"PaleGreen2" , PALETTERGB (144, 238, 144) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
586 {"PaleGreen3" , PALETTERGB (124, 205, 124) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
587 {"PaleGreen4" , PALETTERGB (84, 139, 84) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
588 {"PaleTurquoise" , PALETTERGB (175, 238, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
589 {"PaleTurquoise1" , PALETTERGB (187, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
590 {"PaleTurquoise2" , PALETTERGB (174, 238, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
591 {"PaleTurquoise3" , PALETTERGB (150, 205, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
592 {"PaleTurquoise4" , PALETTERGB (102, 139, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
593 {"PaleVioletRed" , PALETTERGB (219, 112, 147) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
594 {"PaleVioletRed1" , PALETTERGB (255, 130, 171) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
595 {"PaleVioletRed2" , PALETTERGB (238, 121, 159) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
596 {"PaleVioletRed3" , PALETTERGB (205, 104, 137) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
597 {"PaleVioletRed4" , PALETTERGB (139, 71, 93) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
598 {"PaleYellow" , PALETTERGB (255, 255, 128) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
599 {"PapayaWhip" , PALETTERGB (255, 239, 213) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
600 {"PeachPuff" , PALETTERGB (255, 218, 185) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
601 {"PeachPuff1" , PALETTERGB (255, 218, 185) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
602 {"PeachPuff2" , PALETTERGB (238, 203, 173) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
603 {"PeachPuff3" , PALETTERGB (205, 175, 149) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
604 {"PeachPuff4" , PALETTERGB (139, 119, 101) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
605 {"peru" , PALETTERGB (205, 133, 63) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
606 {"pink" , PALETTERGB (255, 192, 203) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
607 {"pink1" , PALETTERGB (255, 181, 197) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
608 {"pink2" , PALETTERGB (238, 169, 184) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
609 {"pink3" , PALETTERGB (205, 145, 158) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
610 {"pink4" , PALETTERGB (139, 99, 108) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
611 {"plum" , PALETTERGB (221, 160, 221) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
612 {"plum1" , PALETTERGB (255, 187, 255) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
613 {"plum2" , PALETTERGB (238, 174, 238) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
614 {"plum3" , PALETTERGB (205, 150, 205) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
615 {"plum4" , PALETTERGB (139, 102, 139) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
616 {"PowderBlue" , PALETTERGB (176, 224, 230) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
617 {"purple" , PALETTERGB (160, 32, 240) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
618 {"purple1" , PALETTERGB (155, 48, 255) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
619 {"purple2" , PALETTERGB (145, 44, 238) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
620 {"purple3" , PALETTERGB (125, 38, 205) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
621 {"purple4" , PALETTERGB (85, 26, 139) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
622 {"red" , PALETTERGB (255, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
623 {"red1" , PALETTERGB (255, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
624 {"red2" , PALETTERGB (238, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
625 {"red3" , PALETTERGB (205, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
626 {"red4" , PALETTERGB (139, 0, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
627 {"RosyBrown" , PALETTERGB (188, 143, 143) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
628 {"RosyBrown1" , PALETTERGB (255, 193, 193) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
629 {"RosyBrown2" , PALETTERGB (238, 180, 180) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
630 {"RosyBrown3" , PALETTERGB (205, 155, 155) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
631 {"RosyBrown4" , PALETTERGB (139, 105, 105) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
632 {"RoyalBlue" , PALETTERGB (65, 105, 225) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
633 {"RoyalBlue1" , PALETTERGB (72, 118, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
634 {"RoyalBlue2" , PALETTERGB (67, 110, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
635 {"RoyalBlue3" , PALETTERGB (58, 95, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
636 {"RoyalBlue4" , PALETTERGB (39, 64, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
637 {"SaddleBrown" , PALETTERGB (139, 69, 19) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
638 {"salmon" , PALETTERGB (250, 128, 114) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
639 {"salmon1" , PALETTERGB (255, 140, 105) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
640 {"salmon2" , PALETTERGB (238, 130, 98) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
641 {"salmon3" , PALETTERGB (205, 112, 84) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
642 {"salmon4" , PALETTERGB (139, 76, 57) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
643 {"SandyBrown" , PALETTERGB (244, 164, 96) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
644 {"SeaGreen" , PALETTERGB (46, 139, 87) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
645 {"SeaGreen1" , PALETTERGB (84, 255, 159) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
646 {"SeaGreen2" , PALETTERGB (78, 238, 148) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
647 {"SeaGreen3" , PALETTERGB (67, 205, 128) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
648 {"SeaGreen4" , PALETTERGB (46, 139, 87) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
649 {"seashell" , PALETTERGB (255, 245, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
650 {"seashell1" , PALETTERGB (255, 245, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
651 {"seashell2" , PALETTERGB (238, 229, 222) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
652 {"seashell3" , PALETTERGB (205, 197, 191) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
653 {"seashell4" , PALETTERGB (139, 134, 130) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
654 {"sienna" , PALETTERGB (160, 82, 45) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
655 {"sienna1" , PALETTERGB (255, 130, 71) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
656 {"sienna2" , PALETTERGB (238, 121, 66) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
657 {"sienna3" , PALETTERGB (205, 104, 57) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
658 {"sienna4" , PALETTERGB (139, 71, 38) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
659 {"SkyBlue" , PALETTERGB (135, 206, 235) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
660 {"SkyBlue1" , PALETTERGB (135, 206, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
661 {"SkyBlue2" , PALETTERGB (126, 192, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
662 {"SkyBlue3" , PALETTERGB (108, 166, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
663 {"SkyBlue4" , PALETTERGB (74, 112, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
664 {"SlateBlue" , PALETTERGB (106, 90, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
665 {"SlateBlue1" , PALETTERGB (131, 111, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
666 {"SlateBlue2" , PALETTERGB (122, 103, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
667 {"SlateBlue3" , PALETTERGB (105, 89, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
668 {"SlateBlue4" , PALETTERGB (71, 60, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
669 {"SlateGray" , PALETTERGB (112, 128, 144) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
670 {"SlateGray1" , PALETTERGB (198, 226, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
671 {"SlateGray2" , PALETTERGB (185, 211, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
672 {"SlateGray3" , PALETTERGB (159, 182, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
673 {"SlateGray4" , PALETTERGB (108, 123, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
674 {"SlateGrey" , PALETTERGB (112, 128, 144) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
675 {"snow" , PALETTERGB (255, 250, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
676 {"snow1" , PALETTERGB (255, 250, 250) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
677 {"snow2" , PALETTERGB (238, 233, 233) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
678 {"snow3" , PALETTERGB (205, 201, 201) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
679 {"snow4" , PALETTERGB (139, 137, 137) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
680 {"SpringGreen" , PALETTERGB (0, 255, 127) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
681 {"SpringGreen1" , PALETTERGB (0, 255, 127) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
682 {"SpringGreen2" , PALETTERGB (0, 238, 118) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
683 {"SpringGreen3" , PALETTERGB (0, 205, 102) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
684 {"SpringGreen4" , PALETTERGB (0, 139, 69) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
685 {"SteelBlue" , PALETTERGB (70, 130, 180) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
686 {"SteelBlue1" , PALETTERGB (99, 184, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
687 {"SteelBlue2" , PALETTERGB (92, 172, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
688 {"SteelBlue3" , PALETTERGB (79, 148, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
689 {"SteelBlue4" , PALETTERGB (54, 100, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
690 {"tan" , PALETTERGB (210, 180, 140) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
691 {"tan1" , PALETTERGB (255, 165, 79) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
692 {"tan2" , PALETTERGB (238, 154, 73) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
693 {"tan3" , PALETTERGB (205, 133, 63) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
694 {"tan4" , PALETTERGB (139, 90, 43) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
695 {"thistle" , PALETTERGB (216, 191, 216) },
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
696 {"thistle1" , PALETTERGB (255, 225, 255) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
697 {"thistle2" , PALETTERGB (238, 210, 238) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
698 {"thistle3" , PALETTERGB (205, 181, 205) },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
699 {"thistle4" , PALETTERGB (139, 123, 139) },
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
700 {"tomato" , PALETTERGB (255, 99, 71) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
701 {"tomato1" , PALETTERGB (255, 99, 71) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
702 {"tomato2" , PALETTERGB (238, 92, 66) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
703 {"tomato3" , PALETTERGB (205, 79, 57) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
704 {"tomato4" , PALETTERGB (139, 54, 38) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
705 {"turquoise" , PALETTERGB (64, 224, 208) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
706 {"turquoise1" , PALETTERGB (0, 245, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
707 {"turquoise2" , PALETTERGB (0, 229, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
708 {"turquoise3" , PALETTERGB (0, 197, 205) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
709 {"turquoise4" , PALETTERGB (0, 134, 139) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
710 {"violet" , PALETTERGB (238, 130, 238) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
711 {"VioletRed" , PALETTERGB (208, 32, 144) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
712 {"VioletRed1" , PALETTERGB (255, 62, 150) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
713 {"VioletRed2" , PALETTERGB (238, 58, 140) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
714 {"VioletRed3" , PALETTERGB (205, 50, 120) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
715 {"VioletRed4" , PALETTERGB (139, 34, 82) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
716 {"wheat" , PALETTERGB (245, 222, 179) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
717 {"wheat1" , PALETTERGB (255, 231, 186) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
718 {"wheat2" , PALETTERGB (238, 216, 174) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
719 {"wheat3" , PALETTERGB (205, 186, 150) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
720 {"wheat4" , PALETTERGB (139, 126, 102) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
721 {"white" , PALETTERGB (255, 255, 255) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
722 {"WhiteSmoke" , PALETTERGB (245, 245, 245) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
723 {"yellow" , PALETTERGB (255, 255, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
724 {"yellow1" , PALETTERGB (255, 255, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
725 {"yellow2" , PALETTERGB (238, 238, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
726 {"yellow3" , PALETTERGB (205, 205, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
727 {"yellow4" , PALETTERGB (139, 139, 0) },
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
728 {"YellowGreen" , PALETTERGB (154, 205, 50) }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
732 typedef struct fontmap_t
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
734 const Ascbyte *name;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
735 int value;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 } fontmap_t;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 /* Default weight first, preferred names listed before synonyms */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
739 static const fontmap_t fontweight_map[] =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 {"Regular" , FW_REGULAR}, /* The standard font weight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 {"Thin" , FW_THIN},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 {"Extra Light" , FW_EXTRALIGHT},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 {"Ultra Light" , FW_ULTRALIGHT},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 {"Light" , FW_LIGHT},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 {"Normal" , FW_NORMAL},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 {"Medium" , FW_MEDIUM},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 {"Semi Bold" , FW_SEMIBOLD},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 {"Demi Bold" , FW_DEMIBOLD},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 {"Bold" , FW_BOLD}, /* The standard bold font weight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 {"Extra Bold" , FW_EXTRABOLD},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 {"Ultra Bold" , FW_ULTRABOLD},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 {"Heavy" , FW_HEAVY},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 {"Black" , FW_BLACK}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
757 /* Default charset must be listed first, no synonyms allowed because these
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
758 * names are matched against the names reported by win32 by match_font() */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
759 static const fontmap_t charset_map[] =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
761 {"Western" , ANSI_CHARSET}, /* Latin 1 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
762 {"Central European" , EASTEUROPE_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
763 {"Cyrillic" , RUSSIAN_CHARSET},
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 {"Greek" , GREEK_CHARSET},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 {"Turkish" , TURKISH_CHARSET},
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
766 {"Hebrew" , HEBREW_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
767 {"Arabic" , ARABIC_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
768 {"Baltic" , BALTIC_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
769 {"Viet Nam" , VIETNAMESE_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
770 {"Thai" , THAI_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
771 {"Japanese" , SHIFTJIS_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
772 {"Korean" , HANGEUL_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
773 {"Simplified Chinese" , GB2312_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
774 {"Traditional Chinese", CHINESEBIG5_CHARSET},
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
775
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
776 {"Symbol" , SYMBOL_CHARSET},
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 {"Mac" , MAC_CHARSET},
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
778 {"Korean Johab" , JOHAB_CHARSET},
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 {"OEM/DOS" , OEM_CHARSET}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
782 #ifdef MULE
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
783
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
784 typedef struct unicode_subrange_raw_t
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
785 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
786 int subrange_bit;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
787 int start; /* first Unicode codepoint */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
788 int end; /* last Unicode codepoint */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
789 } unicode_subrange_raw_t;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
790
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
791 /* This table comes from MSDN, Unicode Subset Bitfields [Platform SDK
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
792 Documentation, Base Services, International Features, Unicode and
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
793 Character Sets, Unicode and Character Set Reference, Unicode and
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
794 Character Set Constants]. We preprocess it at startup time into an
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
795 array of unicode_subrange_t.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
796 */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
797
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
798 static const unicode_subrange_raw_t unicode_subrange_raw_map[] =
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
799 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
800 {0, 0x0020, 0x007e}, /* Basic Latin */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
801 {1, 0x00a0, 0x00ff}, /* Latin-1 Supplement */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
802 {2, 0x0100, 0x017f}, /* Latin Extended-A */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
803 {3, 0x0180, 0x024f}, /* Latin Extended-B */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
804 {4, 0x0250, 0x02af}, /* IPA Extensions */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
805 {5, 0x02b0, 0x02ff}, /* Spacing Modifier Letters */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
806 {6, 0x0300, 0x036f}, /* Combining Diacritical Marks */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
807 {7, 0x0370, 0x03ff}, /* Basic Greek */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
808 /* 8 Reserved */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
809 {9, 0x0400, 0x04ff}, /* Cyrillic */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
810 {10, 0x0530, 0x058f}, /* Armenian */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
811 {11, 0x0590, 0x05ff}, /* Basic Hebrew */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
812 /* 12 Reserved */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
813 {13, 0x0600, 0x06ff}, /* Basic Arabic */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
814 /* 14 Reserved */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
815 {15, 0x0900, 0x097f}, /* Devanagari */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
816 {16, 0x0980, 0x09ff}, /* Bengali */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
817 {17, 0x0a00, 0x0a7f}, /* Gurmukhi */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
818 {18, 0x0a80, 0x0aff}, /* Gujarati */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
819 {19, 0x0b00, 0x0b7f}, /* Oriya */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
820 {20, 0x0b80, 0x0bff}, /* Tamil */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
821 {21, 0x0c00, 0x0c7f}, /* Telugu */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
822 {22, 0x0c80, 0x0cff}, /* Kannada */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
823 {23, 0x0d00, 0x0d7f}, /* Malayalam */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
824 {24, 0x0e00, 0x0e7f}, /* Thai */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
825 {25, 0x0e80, 0x0eff}, /* Lao */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
826 {26, 0x10a0, 0x10ff}, /* Basic Georgian */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
827 /* 27 Reserved */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
828 {28, 0x1100, 0x11ff}, /* Hangul Jamo */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
829 {29, 0x1e00, 0x1eff}, /* Latin Extended Additional */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
830 {30, 0x1f00, 0x1fff}, /* Greek Extended */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
831 {31, 0x2000, 0x206f}, /* General Punctuation */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
832 {32, 0x2070, 0x209f}, /* Subscripts and Superscripts */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
833 {33, 0x20a0, 0x20cf}, /* Currency Symbols */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
834 {34, 0x20d0, 0x20ff}, /* Combining Diacritical Marks for Symbols */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
835 {35, 0x2100, 0x214f}, /* Letter-like Symbols */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
836 {36, 0x2150, 0x218f}, /* Number Forms */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
837 {37, 0x2190, 0x21ff}, /* Arrows */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
838 {38, 0x2200, 0x22ff}, /* Mathematical Operators */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
839 {39, 0x2300, 0x23ff}, /* Miscellaneous Technical */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
840 {40, 0x2400, 0x243f}, /* Control Pictures */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
841 {41, 0x2440, 0x245f}, /* Optical Character Recognition */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
842 {42, 0x2460, 0x24ff}, /* Enclosed Alphanumerics */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
843 {43, 0x2500, 0x257f}, /* Box Drawing */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
844 {44, 0x2580, 0x259f}, /* Block Elements */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
845 {45, 0x25a0, 0x25ff}, /* Geometric Shapes */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
846 {46, 0x2600, 0x26ff}, /* Miscellaneous Symbols */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
847 {47, 0x2700, 0x27bf}, /* Dingbats */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
848 {48, 0x3000, 0x303f}, /* Chinese, Japanese, and Korean (CJK) Symbols and Punctuation */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
849 {49, 0x3040, 0x309f}, /* Hiragana */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
850 {50, 0x30a0, 0x30ff}, /* Katakana */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
851 {51, 0x3100, 0x312f}, /* Bopomofo */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
852 {51, 0x31a0, 0x31bf}, /* Extended Bopomofo */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
853 {52, 0x3130, 0x318f}, /* Hangul Compatibility Jamo */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
854 {53, 0x3190, 0x319f}, /* CJK Miscellaneous */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
855 {54, 0x3200, 0x32ff}, /* Enclosed CJK Letters and Months */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
856 {55, 0x3300, 0x33ff}, /* CJK Compatibility */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
857 {56, 0xac00, 0xd7a3}, /* Hangul */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
858 {57, 0xd800, 0xdfff}, /* Surrogates. Note that setting this bit implies that there is at least one codepoint beyond the Basic Multilingual Plane that is supported by this font. */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
859 /* 58 Reserved */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
860 {59, 0x4e00, 0x9fff}, /* CJK Unified Ideographs */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
861 {59, 0x2e80, 0x2eff}, /* CJK Radicals Supplement */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
862 {59, 0x2f00, 0x2fdf}, /* Kangxi Radicals */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
863 {59, 0x2ff0, 0x2fff}, /* Ideographic Description */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
864 {59, 0x3400, 0x4dbf}, /* CJK Unified Ideograph Extension A */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
865 {60, 0xe000, 0xf8ff}, /* Private Use Area */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
866 {61, 0xf900, 0xfaff}, /* CJK Compatibility Ideographs */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
867 {62, 0xfb00, 0xfb4f}, /* Alphabetic Presentation Forms */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
868 {63, 0xfb50, 0xfdff}, /* Arabic Presentation Forms-A */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
869 {64, 0xfe20, 0xfe2f}, /* Combining Half Marks */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
870 {65, 0xfe30, 0xfe4f}, /* CJK Compatibility Forms */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
871 {66, 0xfe50, 0xfe6f}, /* Small Form Variants */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
872 {67, 0xfe70, 0xfefe}, /* Arabic Presentation Forms-B */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
873 {68, 0xff00, 0xffef}, /* Halfwidth and Fullwidth Forms */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
874 {69, 0xfff0, 0xfffd}, /* Specials */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
875 {70, 0x0f00, 0x0fcf}, /* Tibetan */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
876 {71, 0x0700, 0x074f}, /* Syriac */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
877 {72, 0x0780, 0x07bf}, /* Thaana */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
878 {73, 0x0d80, 0x0dff}, /* Sinhala */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
879 {74, 0x1000, 0x109f}, /* Myanmar */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
880 {75, 0x1200, 0x12bf}, /* Ethiopic */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
881 {76, 0x13a0, 0x13ff}, /* Cherokee */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
882 {77, 0x1400, 0x14df}, /* Canadian Aboriginal Syllabics */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
883 {78, 0x1680, 0x169f}, /* Ogham */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
884 {79, 0x16a0, 0x16ff}, /* Runic */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
885 {80, 0x1780, 0x17ff}, /* Khmer */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
886 {81, 0x1800, 0x18af}, /* Mongolian */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
887 {82, 0x2800, 0x28ff}, /* Braille */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
888 {83, 0xa000, 0xa48c}, /* Yi, Yi Radicals */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
889 /* 84-122 Reserved */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
890 /* 123 Windows 2000/XP: Layout progress: horizontal from right to left */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
891 /* 124 Windows 2000/XP: Layout progress: vertical before horizontal */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
892 /* 125 Windows 2000/XP: Layout progress: vertical bottom to top */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
893 /* 126 Reserved; must be 0 */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
894 /* 127 Reserved; must be 1 */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
895 };
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
896
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
897 typedef struct unicode_subrange_t
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
898 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
899 int no_subranges;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
900 const unicode_subrange_raw_t *subranges;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
901 } unicode_subrange_t;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
902
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
903 unicode_subrange_t *unicode_subrange_table;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
904
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
905 /* Hash table mapping font specs (strings) to font signature data
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
906 (FONTSIGNATURE structures stored in opaques), as determined by
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
907 GetTextCharsetInfo(). I presume this is somewhat expensive because it
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
908 involves creating a font object. At the very least, with no hashing, it
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
909 definitely took awhile (a few seconds) when encountering characters from
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
910 charsets needing stage 2 processing. */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
911 Lisp_Object Vfont_signature_data;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
912
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
913 #endif /* MULE */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
914
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 /* helpers */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 static int
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
921 hexval (Ibyte c)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
923 /* assumes ASCII and isxdigit (c) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 if (c >= 'a')
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
925 return c - 'a' + 10;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 else if (c >= 'A')
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
927 return c - 'A' + 10;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 else
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
929 return c - '0';
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
932 static int
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
933 colormap_t_compare (const void *a, const void *b)
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
934 {
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
935 return ascii_strcasecmp (((colormap_t *)a)->name,
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
936 ((colormap_t *)b)->name);
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
937 }
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
938
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 COLORREF
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
940 mswindows_string_to_color (const Ibyte *name)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 if (*name == '#')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 /* numeric names look like "#RRGGBB", "#RRRGGGBBB" or "#RRRRGGGGBBBB"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 or "rgb:rrrr/gggg/bbbb" */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 unsigned int r, g, b;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
949
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
950 for (i = 1; i < qxestrlen (name); i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 {
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
952 if (!byte_ascii_p (name[i]) || !isxdigit ((int) name[i]))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 return (COLORREF) -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
955 if (qxestrlen (name) == 7)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 r = hexval (name[1]) * 16 + hexval (name[2]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 g = hexval (name[3]) * 16 + hexval (name[4]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 b = hexval (name[5]) * 16 + hexval (name[6]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 return (PALETTERGB (r, g, b));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
962 else if (qxestrlen (name) == 10)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 r = hexval (name[1]) * 16 + hexval (name[2]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 g = hexval (name[4]) * 16 + hexval (name[5]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 b = hexval (name[7]) * 16 + hexval (name[8]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 return (PALETTERGB (r, g, b));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
969 else if (qxestrlen (name) == 13)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 r = hexval (name[1]) * 16 + hexval (name[2]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 g = hexval (name[5]) * 16 + hexval (name[6]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 b = hexval (name[9]) * 16 + hexval (name[10]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 return (PALETTERGB (r, g, b));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 }
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
977 else if (!qxestrncmp_ascii (name, "rgb:", 4))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
979 unsigned int r, g, b;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
981 if (sscanf ((CIbyte *) name, "rgb:%04x/%04x/%04x", &r, &g, &b) == 3)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
983 int len = qxestrlen (name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 if (len == 18)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 r /= 257;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 g /= 257;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 b /= 257;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 else if (len == 15)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 r /= 17;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 g /= 17;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 b /= 17;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 return (PALETTERGB (r, g, b));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
998 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 return (COLORREF) -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 else if (*name) /* Can't be an empty string */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 {
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1003 colormap_t key = { alloca_ascbytes (qxestrlen (name) + 1),
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1004 PALETTERGB (255, 255, 255) }, *res;
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1005 Ascbyte *c = (Ascbyte *)(key.name);
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1006
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 while (*name)
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1008 {
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1009 if (*name != ' ')
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1010 {
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1011 if (!byte_ascii_p (*name))
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1012 {
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1013 return (COLORREF) -1;
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1014 }
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1015
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1016 *c++ = *name++;
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1017 }
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1018 else
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1019 {
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1020 name++;
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1021 }
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1022 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 *c = '\0';
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1024
5256
6c8f5574d4a1 Fix the C++, Visual Studio 2005 builds.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5218
diff changeset
1025 if ((res = (colormap_t *) bsearch (&key, mswindows_X_color_map,
6c8f5574d4a1 Fix the C++, Visual Studio 2005 builds.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5218
diff changeset
1026 countof (mswindows_X_color_map),
6c8f5574d4a1 Fix the C++, Visual Studio 2005 builds.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5218
diff changeset
1027 sizeof (mswindows_X_color_map[0]),
6c8f5574d4a1 Fix the C++, Visual Studio 2005 builds.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5218
diff changeset
1028 colormap_t_compare)) != NULL)
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1029 {
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1030 return res->colorref;
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
1031 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 return (COLORREF) -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1036 Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1037 mswindows_color_to_string (COLORREF color)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1038 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1039 int i;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1040 Ascbyte buf[8];
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1041 COLORREF pcolor = PALETTERGB (GetRValue (color), GetGValue (color),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1042 GetBValue (color));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1043
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1044 for (i = 0; i < countof (mswindows_X_color_map); i++)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1045 if (pcolor == (mswindows_X_color_map[i].colorref))
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
1046 return build_ascstring (mswindows_X_color_map[i].name);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1047
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1048 sprintf (buf, "#%02X%02X%02X",
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1049 GetRValue (color), GetGValue (color), GetBValue (color));
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
1050 return build_ascstring (buf);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1051 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1052
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 * Returns non-zero if the two supplied font patterns match.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 * If they match and fontname is not NULL, copies the logical OR of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 * patterns to fontname (which is assumed to be at least MSW_FONTSIZE in size).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 * The patterns 'match' iff for each field that is not blank in either pattern,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 * the corresponding field in the other pattern is either identical or blank.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 static int
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1062 match_font (Ibyte *pattern1, Ibyte *pattern2,
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1063 Ibyte *fontname)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1065 Ibyte *c1 = pattern1, *c2 = pattern2, *e1 = 0, *e2 = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 if (fontname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 fontname[0] = '\0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1071 for (i = 0; i < 5; i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1073 if (c1 && (e1 = qxestrchr (c1, ':')))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 *(e1) = '\0';
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1075 if (c2 && (e2 = qxestrchr (c2, ':')))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 *(e2) = '\0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1078 if (c1 && c1[0] != '\0')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1080 if (c2 && c2[0] != '\0' && qxestrcasecmp (c1, c2))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 if (e1) *e1 = ':';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 if (e2) *e2 = ':';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 else if (fontname)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1087 qxestrcat_ascii (qxestrcat (fontname, c1), ":");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 else if (fontname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1091 if (c2 && c2[0] != '\0')
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1092 qxestrcat_ascii (qxestrcat (fontname, c2), ":");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 else
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1094 qxestrcat_ascii (fontname, ":");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 if (e1) *(e1++) = ':';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 if (e2) *(e2++) = ':';
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1099 c1 = e1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1100 c2 = e2;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 if (fontname)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1104 fontname[qxestrlen (fontname) - 1] = '\0'; /* Trim trailing ':' */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 /* exports */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 struct font_enum_t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 HDC hdc;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1116 Lisp_Object list;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 static int CALLBACK
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1120 font_enum_callback_2 (ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEXW *lpntme,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1121 int FontType, struct font_enum_t *font_enum)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1122 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1123 Ibyte fontname[MSW_FONTSIZE * 2 * MAX_ICHAR_LEN]; /* should be enough :)*/
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1124 Lisp_Object fontname_lispstr;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1125 int i;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1126 Ibyte *facename;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 * The enumerated font weights are not to be trusted because:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 * a) lpelfe->elfStyle is only filled in for TrueType fonts.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1131 * b) Not all Bold and Italic styles of all fonts (including some Vector,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 * Truetype and Raster fonts) are enumerated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 * I guess that fonts for which Bold and Italic styles are generated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 * 'on-the-fly' are not enumerated. It would be overly restrictive to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 * disallow Bold And Italic weights for these fonts, so we just leave
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 * weights unspecified. This means that we have to weed out duplicates of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 * those fonts that do get enumerated with different weights.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 */
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4953
diff changeset
1139 facename = TSTR_TO_ITEXT (lpelfe->elfLogFont.lfFaceName);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1140 if (itext_ichar (facename) == '@')
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1141 /* This is a font for writing vertically. We ignore it. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1142 return 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1143
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1144 if (FontType == 0 /*vector*/ || FontType & TRUETYPE_FONTTYPE)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 /* Scalable, so leave pointsize blank */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1146 qxesprintf (fontname, "%s::::", facename);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 /* Formula for pointsize->height from LOGFONT docs in Platform SDK */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1149 qxesprintf (fontname, "%s::%d::", facename,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1150 MulDiv (lpntme->ntmTm.tmHeight -
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1151 lpntme->ntmTm.tmInternalLeading,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1152 72, GetDeviceCaps (font_enum->hdc, LOGPIXELSY)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 * The enumerated font character set strings are not to be trusted because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 * lpelfe->elfScript is returned in the host language and not in English.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 * We can't know a priori the translations of "Western", "Central European"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 * etc into the host language, so we must use English. The same argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 * applies to the font weight string when matching fonts.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1161 for (i = 0; i < countof (charset_map); i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 if (lpelfe->elfLogFont.lfCharSet == charset_map[i].value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1164 qxestrcat_ascii (fontname, charset_map[i].name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1167 if (i == countof (charset_map))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1168 return 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1170 /* Add the font name to the list if not already there */
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1171 fontname_lispstr = build_istring (fontname);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1172 if (NILP (Fassoc (fontname_lispstr, font_enum->list)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1173 font_enum->list =
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1174 Fcons (Fcons (fontname_lispstr,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1175 /* TMPF_FIXED_PITCH is backwards from what you expect!
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1176 If set, it means NOT fixed pitch. */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1177 (lpntme->ntmTm.tmPitchAndFamily & TMPF_FIXED_PITCH) ?
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1178 Qnil : Qt),
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1179 font_enum->list);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 static int CALLBACK
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1185 font_enum_callback_1 (ENUMLOGFONTEXW *lpelfe,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1186 NEWTEXTMETRICEXW *UNUSED (lpntme),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1187 int UNUSED (FontType), struct font_enum_t *font_enum)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 /* This function gets called once per facename per character set.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 * We call a second callback to enumerate the fonts in each facename */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1191 return qxeEnumFontFamiliesEx (font_enum->hdc, &lpelfe->elfLogFont,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1192 (FONTENUMPROCW) font_enum_callback_2,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1193 (LPARAM) font_enum, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1196 /* Function for sorting lists of fonts as obtained from
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1197 mswindows_enumerate_fonts(). These come in a known format:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1198 "family::::charset" for TrueType fonts, "family::size::charset"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1199 otherwise. */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1200
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1201 static Boolint
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1202 sort_font_list_function (Lisp_Object UNUSED (pred), Lisp_Object UNUSED (key),
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1203 Lisp_Object obj1, Lisp_Object obj2)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1204 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1205 Ibyte *font1, *font2;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1206 Ibyte *c1, *c2;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1207 int t1, t2;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1208
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1209 /*
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1210 1. fixed over proportional.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1211 2. Western over other charsets.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1212 3. TrueType over non-TrueType.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1213 4. Within non-TrueType, sizes closer to 10pt over sizes farther from 10pt.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1214 5. Courier New over other families.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1215 */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1216
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1217 /* The sort function should return non-zero if OBJ1 < OBJ2, zero
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1218 otherwise. */
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1219
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1220 t1 = !NILP (XCDR (obj1));
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1221 t2 = !NILP (XCDR (obj2));
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1222
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1223 if (t1 && !t2)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1224 return 1;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1225 if (t2 && !t1)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1226 return 0;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1227
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1228 font1 = XSTRING_DATA (XCAR (obj1));
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1229 font2 = XSTRING_DATA (XCAR (obj2));
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1230
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1231 c1 = qxestrrchr (font1, ':');
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1232 c2 = qxestrrchr (font2, ':');
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1233
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1234 t1 = !qxestrcasecmp_ascii (c1 + 1, "western");
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1235 t2 = !qxestrcasecmp_ascii (c2 + 1, "western");
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1236
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1237 if (t1 && !t2)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1238 return 1;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1239 if (t2 && !t1)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1240 return 0;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1241
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1242 c1 -= 2;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1243 c2 -= 2;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1244 t1 = *c1 == ':';
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1245 t2 = *c2 == ':';
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1246
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1247 if (t1 && !t2)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1248 return 1;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1249 if (t2 && !t1)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1250 return 0;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1251
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1252 if (!t1 && !t2)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1253 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1254 while (isdigit (*c1))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1255 c1--;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1256 while (isdigit (*c2))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1257 c2--;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1258
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1259 t1 = qxeatoi (c1 + 1) - 10;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1260 t2 = qxeatoi (c2 + 1) - 10;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1261
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1262 if (abs (t1) < abs (t2))
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1263 return 1;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1264 else if (abs (t2) < abs (t1))
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1265 return 0;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1266 else if (t1 < t2)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1267 /* Prefer a smaller font over a larger one just as far away
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1268 because the smaller one won't upset the total line height if it's
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1269 just a few chars. */
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1270 return 1;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1271 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1272
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1273 t1 = !qxestrncasecmp_ascii (font1, "courier new:", 12);
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1274 t2 = !qxestrncasecmp_ascii (font2, "courier new:", 12);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1275
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1276 if (t1 && !t2)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1277 return 1;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1278 if (t2 && !t1)
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1279 return 0;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1280
5350
94bbd4792049 Have #'sort*, #'merge use the same test approach as functions from cl-seq.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5256
diff changeset
1281 return 0;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1282 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1283
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 /*
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1285 * Enumerate the available on the HDC fonts and return a list of string
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1286 * font names.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1288 Lisp_Object
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1289 mswindows_enumerate_fonts (HDC hdc)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1291 /* This cannot GC */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1292 LOGFONTW logfont;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 struct font_enum_t font_enum;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1295 assert (hdc != NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296 logfont.lfCharSet = DEFAULT_CHARSET;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 logfont.lfFaceName[0] = '\0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 logfont.lfPitchAndFamily = DEFAULT_PITCH;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 font_enum.hdc = hdc;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1300 font_enum.list = Qnil;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1301 /* EnumFontFamilies seems to enumerate only one charset per font, which
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1302 is not what we want. We aren't supporting NT 3.5x, so no need to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1303 worry about this not existing. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1304 qxeEnumFontFamiliesEx (hdc, &logfont, (FONTENUMPROCW) font_enum_callback_1,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1305 (LPARAM) (&font_enum), 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1306
5182
2e528066e2fc Move #'sort*, #'fill, #'merge to C from cl-seq.el.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5176
diff changeset
1307 return list_sort (font_enum.list, sort_font_list_function, Qnil, Qidentity);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1310 static HFONT
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1311 mswindows_create_font_variant (Lisp_Font_Instance *f,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1312 int under, int strike)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1313 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1314 /* Cannot GC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1315 LOGFONTW lf;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1316 HFONT hfont;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1317
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1318 assert (FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, under, strike) == NULL);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1319
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1320 if (qxeGetObject (FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1321 sizeof (lf), (void *) &lf) == 0)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1322 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1323 hfont = MSWINDOWS_BAD_HFONT;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1324 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1325 else
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1326 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1327 lf.lfUnderline = under;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1328 lf.lfStrikeOut = strike;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1329
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1330 hfont = qxeCreateFontIndirect (&lf);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1331 if (hfont == NULL)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1332 hfont = MSWINDOWS_BAD_HFONT;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1333 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1334
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1335 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, under, strike) = hfont;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1336 return hfont;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1337 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1338
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1339 HFONT
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1340 mswindows_get_hfont (Lisp_Font_Instance *f,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1341 int under, int strike)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1342 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1343 /* Cannot GC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1344 HFONT hfont = FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, under, strike);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1345
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1346 if (hfont == NULL)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1347 hfont = mswindows_create_font_variant (f, under, strike);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1348
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1349 /* If strikeout/underline variant of the font could not be
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1350 created, then use the base version of the font */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1351 if (hfont == MSWINDOWS_BAD_HFONT)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1352 hfont = FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1353
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1354 assert (hfont != NULL && hfont != MSWINDOWS_BAD_HFONT);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1355
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1356 return hfont;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1357 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 /* methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 static int
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1364 mswindows_initialize_color_instance (Lisp_Color_Instance *c, Lisp_Object name,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1365 Lisp_Object UNUSED (device),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1366 Error_Behavior errb)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 COLORREF color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1370 color = mswindows_string_to_color (XSTRING_DATA (name));
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 593
diff changeset
1371 if (color != (COLORREF) -1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 c->data = xnew (struct mswindows_color_instance_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 COLOR_INSTANCE_MSWINDOWS_COLOR (c) = color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 }
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 442
diff changeset
1377 maybe_signal_error (Qinvalid_constant,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1378 "Unrecognized color", name, Qcolor, errb);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 return(0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1384 mswindows_mark_color_instance (Lisp_Color_Instance *c)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1390 mswindows_print_color_instance (Lisp_Color_Instance *c,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1391 Lisp_Object printcharfun,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1392 int UNUSED (escapeflag))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1395 write_fmt_string (printcharfun,
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1396 " %06ld=(%04X,%04X,%04X)", color & 0xffffff,
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1397 GetRValue (color) * 257, GetGValue (color) * 257,
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1398 GetBValue (color) * 257);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1402 mswindows_finalize_color_instance (Lisp_Color_Instance *c)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 if (c->data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4953
diff changeset
1406 xfree (c->data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 c->data = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1409 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 static int
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1412 mswindows_color_instance_equal (Lisp_Color_Instance *c1,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1413 Lisp_Color_Instance *c2,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1414 int UNUSED (depth))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1416 return (COLOR_INSTANCE_MSWINDOWS_COLOR (c1) ==
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1417 COLOR_INSTANCE_MSWINDOWS_COLOR (c2));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1418 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419
2515
de9952d2ed18 [xemacs-hg @ 2005-01-26 10:22:19 by ben]
ben
parents: 2500
diff changeset
1420 static Hashcode
5192
635f4b506855 Call internal_hash() with its new arg, Win32-specific code, fixing build
Aidan Kehoe <kehoea@parhasard.net>
parents: 5191
diff changeset
1421 mswindows_color_instance_hash (Lisp_Color_Instance *c, int UNUSED (depth))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1423 return (unsigned long) COLOR_INSTANCE_MSWINDOWS_COLOR (c);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426 static Lisp_Object
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1427 mswindows_color_instance_rgb_components (Lisp_Color_Instance *c)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 return list3 (make_int (GetRValue (color) * 257),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 make_int (GetGValue (color) * 257),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432 make_int (GetBValue (color) * 257));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1436 mswindows_valid_color_name_p (struct device *UNUSED (d), Lisp_Object color)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1438 return (mswindows_string_to_color (XSTRING_DATA (color)) != (COLORREF) -1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1444 mswindows_finalize_font_instance (Lisp_Font_Instance *f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1446 /* Parse the font spec in NAMESTR. Maybe issue errors, according to ERRB;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1447 NAME_FOR_ERRORS is the Lisp string to use when issuing errors. Store
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1448 the five parts of the font spec into the given strings, which should be
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1449 declared as
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1450
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1451 Ibyte fontname[LF_FACESIZE], weight[LF_FACESIZE], points[8];
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1452 Ibyte effects[LF_FACESIZE], charset[LF_FACESIZE];
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1453
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1454 If LOGFONT is given, store the necessary information in LOGFONT to
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1455 create a font object. If LOGFONT is given, HDC must also be given;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1456 else, NULL can be given for both.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1457
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1458 Return 1 if ok, 0 if error.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1459 */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1460 static int
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1461 parse_font_spec (const Ibyte *namestr,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1462 HDC hdc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1463 Lisp_Object name_for_errors,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1464 Error_Behavior errb,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1465 LOGFONTW *logfont,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1466 Ibyte *fontname,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1467 Ibyte *weight,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1468 Ibyte *points,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1469 Ibyte *effects,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1470 Ibyte *charset)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1471 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 int fields, i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473 int pt;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1474 Ibyte *style;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1475 Ibyte *c;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 * mswindows fonts look like:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479 * fontname[:[weight ][style][:pointsize[:effects]]][:charset]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480 * The font name field shouldn't be empty.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482 * ie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 * Lucida Console:Regular:10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 * minimal:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 * Courier New
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 * maximal:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 * Courier New:Bold Italic:10:underline strikeout:western
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1490 fontname[0] = 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1491 weight[0] = 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1492 points[0] = 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1493 effects[0] = 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1494 charset[0] = 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1495
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1496 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1497 xzero (*logfont);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1498
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1499 fields = sscanf ((CIbyte *) namestr, "%31[^:]:%31[^:]:%7[^:]:%31[^:]:%31s",
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500 fontname, weight, points, effects, charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 /* This function is implemented in a fairly ad-hoc manner.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 * The general idea is to validate and canonicalize each of the above fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 * at the same time as we build up the win32 LOGFONT structure. This enables
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 * us to use match_font() on a canonicalized font string to check the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 * availability of the requested font */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 if (fields < 0)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1509 {
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1510 maybe_signal_error (Qinvalid_argument, "Invalid font", name_for_errors,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1511 Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1512 return 0;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1513 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1514
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1515 if (fields > 0 && qxestrlen (fontname))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1516 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1517 Extbyte *extfontname;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4953
diff changeset
1519 extfontname = ITEXT_TO_TSTR (fontname);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1520 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1521 {
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
1522 qxetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname,
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1523 LF_FACESIZE - 1);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1524 logfont->lfFaceName[LF_FACESIZE - 1] = 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1525 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1526 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 /* weight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529 if (fields < 2)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1530 qxestrcpy_ascii (weight, fontweight_map[0].name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 /* Maybe split weight into weight and style */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1533 if ((c = qxestrchr (weight, ' ')))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1534 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1535 *c = '\0';
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1536 style = c + 1;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1537 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 style = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1541 for (i = 0; i < countof (fontweight_map); i++)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1542 if (!qxestrcasecmp_ascii (weight, fontweight_map[i].name))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1543 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1544 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1545 logfont->lfWeight = fontweight_map[i].value;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 if (i == countof (fontweight_map)) /* No matching weight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 if (!style)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1552 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1553 logfont->lfWeight = FW_REGULAR;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 style = weight; /* May have specified style without weight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 {
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1558 maybe_signal_error (Qinvalid_constant, "Invalid font weight",
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1559 name_for_errors, Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1560 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 if (style)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 /* #### what about oblique? */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1567 if (qxestrcasecmp_ascii (style, "italic") == 0)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1568 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1569 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1570 logfont->lfItalic = TRUE;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1571 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 else
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1573 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1574 maybe_signal_error (Qinvalid_constant,
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1575 "Invalid font weight or style",
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1576 name_for_errors, Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1577 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 /* Glue weight and style together again */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 if (weight != style)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 *c = ' ';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 }
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1584 else if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1585 logfont->lfItalic = FALSE;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1587 if (fields < 3 || !qxestrcmp_ascii (points, ""))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1588 ;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1589 else if (points[0] == '0' ||
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1590 qxestrspn (points, "0123456789") < qxestrlen (points))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 {
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1592 maybe_signal_error (Qinvalid_argument, "Invalid font pointsize",
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1593 name_for_errors, Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1594 return 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1595 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1596 else
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1597 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1598 pt = qxeatoi (points);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1599
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1600 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1601 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1602 /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1603 SDK */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1604 logfont->lfHeight = -MulDiv (pt, GetDeviceCaps (hdc, LOGPIXELSY),
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1605 72);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1606 logfont->lfWidth = 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1607 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1610 /* Effects */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1611 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1612 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1613 logfont->lfUnderline = FALSE;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1614 logfont->lfStrikeOut = FALSE;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1615 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 if (fields >= 4 && effects[0] != '\0')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1619 Ibyte *effects2;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1620 int underline = FALSE, strikeout = FALSE;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622 /* Maybe split effects into effects and effects2 */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1623 if ((c = qxestrchr (effects, ' ')))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 *c = '\0';
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1626 effects2 = c + 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 effects2 = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1631 if (qxestrcasecmp_ascii (effects, "underline") == 0)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1632 underline = TRUE;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1633 else if (qxestrcasecmp_ascii (effects, "strikeout") == 0)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1634 strikeout = TRUE;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1635 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 {
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1637 maybe_signal_error (Qinvalid_constant, "Invalid font effect",
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1638 name_for_errors, Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1639 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 if (effects2 && effects2[0] != '\0')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1644 if (qxestrcasecmp_ascii (effects2, "underline") == 0)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1645 underline = TRUE;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1646 else if (qxestrcasecmp_ascii (effects2, "strikeout") == 0)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1647 strikeout = TRUE;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1650 maybe_signal_error (Qinvalid_constant, "Invalid font effect",
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1651 name_for_errors, Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1652 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1656 /* Regenerate sanitized effects string */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1657 if (underline)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1659 if (strikeout)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1660 qxestrcpy_ascii (effects, "underline strikeout");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 else
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1662 qxestrcpy_ascii (effects, "underline");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 }
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1664 else if (strikeout)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1665 qxestrcpy_ascii (effects, "strikeout");
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1666
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1667 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1668 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1669 logfont->lfUnderline = underline;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1670 logfont->lfStrikeOut = strikeout;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1671 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 /* Charset */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1675 /* charset can be specified even if earlier fields haven't been */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676 if (fields < 5)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1677 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1678 if ((c = qxestrchr (namestr, ':')) && (c = qxestrchr (c + 1, ':')) &&
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1679 (c = qxestrchr (c + 1, ':')) && (c = qxestrchr (c + 1, ':')))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1681 qxestrncpy (charset, c + 1, LF_FACESIZE);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1682 charset[LF_FACESIZE - 1] = '\0';
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1686 /* NOTE: If you give a blank charset spec, we will normally not get here
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1687 under Mule unless we explicitly call `make-font-instance'! This is
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1688 because the C code instantiates fonts using particular charsets, by
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1689 way of specifier_matching_instance(). Before instantiating the font,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1690 font_instantiate() calls the devmeth find_matching_font(), which gets
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1691 a truename font spec with the registry (i.e. the charset spec) filled
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1692 in appropriately to the charset. */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1693 if (!qxestrcmp_ascii (charset, ""))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1694 ;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1695 else
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1696 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1697 for (i = 0; i < countof (charset_map); i++)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
1698 if (!qxestrcasecmp_ascii (charset, charset_map[i].name))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1699 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1700 if (logfont)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1701 logfont->lfCharSet = charset_map[i].value;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1702 break;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1703 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1705 if (i == countof (charset_map)) /* No matching charset */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1706 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1707 maybe_signal_error (Qinvalid_argument, "Invalid charset",
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1708 name_for_errors, Qfont, errb);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1709 return 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1710 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1711 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1712
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1713 if (logfont)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1715 /* Misc crud */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1716 #if 1
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1717 logfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1718 logfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1719 logfont->lfQuality = DEFAULT_QUALITY;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1720 #else
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1721 logfont->lfOutPrecision = OUT_STROKE_PRECIS;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1722 logfont->lfClipPrecision = CLIP_STROKE_PRECIS;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1723 logfont->lfQuality = PROOF_QUALITY;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1724 #endif
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1725 /* Default to monospaced if the specified fontname doesn't exist. */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1726 logfont->lfPitchAndFamily = FF_MODERN;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1729 return 1;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1730 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1731
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1732 /*
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1733 mswindows fonts look like:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1734 [fontname[:style[:pointsize[:effects]]]][:charset]
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1735 A maximal mswindows font spec looks like:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1736 Courier New:Bold Italic:10:underline strikeout:Western
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1737
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1738 A missing weight/style field is the same as Regular, and a missing
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1739 effects field is left alone, and means no effects; but a missing
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1740 fontname, pointsize or charset field means any will do. We prefer
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1741 Courier New, 10, Western. See sort function above. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1743 static HFONT
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1744 create_hfont_from_font_spec (const Ibyte *namestr,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1745 HDC hdc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1746 Lisp_Object name_for_errors,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1747 Lisp_Object device_font_list,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1748 Error_Behavior errb,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1749 Lisp_Object *truename_ret)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1750 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1751 LOGFONTW logfont;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1752 HFONT hfont;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1753 Ibyte fontname[LF_FACESIZE], weight[LF_FACESIZE], points[8];
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1754 Ibyte effects[LF_FACESIZE], charset[LF_FACESIZE];
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1755 Ibyte truename[MSW_FONTSIZE];
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1756 Ibyte truername[MSW_FONTSIZE];
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1757
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1758 /* Windows will silently substitute a default font if the fontname
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1759 specifies a non-existent font. This is bad for screen fonts because
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1760 it doesn't allow higher-level code to see the error and to act
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1761 appropriately. For instance complex_vars_of_faces() sets up a
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1762 fallback list of fonts for the default face. Instead, we look at all
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1763 the possibilities and pick one that works, handling missing pointsize
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1764 and charset fields appropriately.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1765
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1766 For printer fonts, we used to go ahead and let Windows choose the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1767 font, and for those devices, then, DEVICE_FONT_LIST would be nil.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1768 However, this causes problems with the font-matching code below, which
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1769 needs a list of fonts so it can pick the right one for Mule.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1770
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1771 Thus, the code below to handle a nil DEVICE_FONT_LIST is not currently
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1772 used. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1773
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1774 if (!NILP (device_font_list))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1775 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1776 Lisp_Object fonttail = Qnil;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1777
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1778 if (!parse_font_spec (namestr, 0, name_for_errors,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1779 errb, 0, fontname, weight, points,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1780 effects, charset))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1781 return 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1782
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1783 /* The fonts in the device font list always specify fontname and
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1784 charset, but often times not the size; so if we don't have the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1785 size specified either, do a round with size 10 so we'll always end
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1786 up with a size in the truename (if we fail this one but succeed
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1787 the next one, we'll have chosen a non-TrueType font, and in those
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1788 cases the size is specified in the font list item. */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1789
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1790 if (!points[0])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1791 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1792 qxesprintf (truename, "%s:%s:10:%s:%s",
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1793 fontname, weight, effects, charset);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1795 LIST_LOOP (fonttail, device_font_list)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1796 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1797 if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))),
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1798 truename, truername))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1799 break;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1800 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1801 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1802
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1803 if (NILP (fonttail))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1804 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1805 qxesprintf (truename, "%s:%s:%s:%s:%s",
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1806 fontname, weight, points, effects, charset);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1807
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1808 LIST_LOOP (fonttail, device_font_list)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1809 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1810 if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))),
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1811 truename, truername))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1812 break;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1813 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1814 }
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1815
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1816 if (NILP (fonttail))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1817 {
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1818 maybe_signal_error (Qinvalid_argument, "No matching font",
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1819 name_for_errors, Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1820 return 0;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1821 }
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1822
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1823 if (!parse_font_spec (truername, hdc, name_for_errors,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1824 ERROR_ME_DEBUG_WARN, &logfont, fontname, weight,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1825 points, effects, charset))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1826 signal_error (Qinternal_error, "Bad value in device font list?",
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1827 build_istring (truername));
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1828 }
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1829 else if (!parse_font_spec (namestr, hdc, name_for_errors,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1830 errb, &logfont, fontname, weight, points,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1831 effects, charset))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1832 return 0;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1833
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1834 if ((hfont = qxeCreateFontIndirect (&logfont)) == NULL)
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1835 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1836 maybe_signal_error (Qgui_error, "Couldn't create font",
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1837 name_for_errors, Qfont, errb);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1838 return 0;
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1839 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1840
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1841 /* #### Truename will not have all its fields filled in when we have no
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1842 list of fonts. Doesn't really matter now, since we always have one.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1843 See above. */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1844 qxesprintf (truename, "%s:%s:%s:%s:%s", fontname, weight,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1845 points, effects, charset);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1846
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1847 *truename_ret = build_istring (truename);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1848 return hfont;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1849 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1850
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1851 /*
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1852 * This is a work horse for both mswindows_initialize_font_instance and
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1853 * msprinter_initialize_font_instance.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1854 */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1855 static int
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1856 initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name,
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1857 Lisp_Object device_font_list, HDC hdc,
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1858 Error_Behavior errb)
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1859 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1860 HFONT hfont, hfont2;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1861 TEXTMETRICW metrics;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1862 Ibyte *namestr = XSTRING_DATA (name);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1863 Lisp_Object truename;
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1864
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1865 hfont = create_hfont_from_font_spec (namestr, hdc, name, device_font_list,
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1866 errb, &truename);
4932
8b63e21b0436 fix compile issues with gcc 4
Ben Wing <ben@xemacs.org>
parents: 4579
diff changeset
1867 if (!hfont)
8b63e21b0436 fix compile issues with gcc 4
Ben Wing <ben@xemacs.org>
parents: 4579
diff changeset
1868 return 0;
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1869 f->truename = truename;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1870 f->data = xnew_and_zero (struct mswindows_font_instance_data);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1871 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0) = hfont;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1872
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1873 /* Some underlined fonts have the descent of one pixel more than their
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1874 non-underlined counterparts. Font variants though are assumed to have
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1875 identical metrics. So get the font metrics from the underlined variant
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1876 of the font */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1877 hfont2 = mswindows_create_font_variant (f, 1, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1878 if (hfont2 != MSWINDOWS_BAD_HFONT)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1879 hfont = hfont2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1880
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1881 hfont2 = (HFONT) SelectObject (hdc, hfont);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1882 if (!hfont2)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1884 mswindows_finalize_font_instance (f);
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 442
diff changeset
1885 maybe_signal_error (Qgui_error, "Couldn't map font", name, Qfont, errb);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1886 return 0;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1887 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1888 qxeGetTextMetrics (hdc, &metrics);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1889 SelectObject (hdc, hfont2);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1890
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1891 f->width = (unsigned short) metrics.tmAveCharWidth;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1892 f->height = (unsigned short) metrics.tmHeight;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1893 f->ascent = (unsigned short) metrics.tmAscent;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1894 f->descent = (unsigned short) metrics.tmDescent;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1895 f->proportional_p = (metrics.tmPitchAndFamily & TMPF_FIXED_PITCH);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1896
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1897 return 1;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1898 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1899
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1900 static int
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1901 mswindows_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 563
diff changeset
1902 Lisp_Object device, Error_Behavior errb)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1903 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1904 HDC hdc = CreateCompatibleDC (NULL);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1905 Lisp_Object font_list = DEVICE_MSWINDOWS_FONTLIST (XDEVICE (device));
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1906 int res = initialize_font_instance (f, name, font_list, hdc, errb);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1907 DeleteDC (hdc);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1908 return res;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1909 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1910
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1911 static int
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1912 msprinter_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 563
diff changeset
1913 Lisp_Object device, Error_Behavior errb)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1914 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1915 HDC hdc = DEVICE_MSPRINTER_HDC (XDEVICE (device));
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1916 Lisp_Object font_list = DEVICE_MSPRINTER_FONTLIST (XDEVICE (device));
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1917 return initialize_font_instance (f, name, font_list, hdc, errb);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1918 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1919
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1920 static void
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1921 mswindows_finalize_font_instance (Lisp_Font_Instance *f)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1922 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1923 int i;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1924
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1925 if (f->data)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1926 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1927 for (i = 0; i < MSWINDOWS_NUM_FONT_VARIANTS; i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1929 if (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != NULL
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1930 && FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != MSWINDOWS_BAD_HFONT)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1931 DeleteObject (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1933
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4953
diff changeset
1934 xfree (f->data);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1935 f->data = 0;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1936 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1941 mswindows_mark_font_instance (Lisp_Font_Instance *f)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1947 mswindows_print_font_instance (Lisp_Font_Instance *f,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1948 Lisp_Object printcharfun,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1949 int UNUSED (escapeflag))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1951 write_fmt_string (printcharfun, " 0x%lx",
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1952 (unsigned long)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1953 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0));
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1954
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957 static Lisp_Object
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
1958 mswindows_font_list (Lisp_Object pattern, Lisp_Object device,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1959 Lisp_Object UNUSED (maxnumber))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1961 struct device *d = XDEVICE (device);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1962 Lisp_Object font_list = Qnil, fonttail, result = Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1963
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1964 if (DEVICE_MSWINDOWS_P (d))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1965 font_list = DEVICE_MSWINDOWS_FONTLIST (d);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1966 else if (DEVICE_MSPRINTER_P (d))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1967 font_list = DEVICE_MSPRINTER_FONTLIST (d);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1968 else
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2421
diff changeset
1969 ABORT ();
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
1970
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1971 LIST_LOOP (fonttail, font_list)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
1973 Ibyte fontname[MSW_FONTSIZE];
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1974
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1975 if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))),
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1976 XSTRING_DATA (pattern),
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1977 fontname))
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1978 result = Fcons (build_istring (fontname), result);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 return Fnreverse (result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1985 mswindows_font_instance_truename (Lisp_Font_Instance *f,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1986 Error_Behavior UNUSED (errb))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1988 return f->truename;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
1994 mswindows_font_spec_matches_charset_stage_1 (struct device *UNUSED (d),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1995 Lisp_Object charset,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1996 const Ibyte *nonreloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1997 Lisp_Object reloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1998 Bytecount offset,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1999 Bytecount length)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2001 int i;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2002 Lisp_Object charset_registry;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2003 const Ibyte *font_charset;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
2004 const Ibyte *the_nonreloc = nonreloc;
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
2005 const Ibyte *c;
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2006 Bytecount the_length = length;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2007
4353
4143b78d0df0 Merge an old patch of Ben's, involving font instantiation and charsets.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3662
diff changeset
2008 if (NILP (charset))
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2009 return 1;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2010
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2011 if (!the_nonreloc)
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2012 the_nonreloc = XSTRING_DATA (reloc);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2013 fixup_internal_substring (nonreloc, reloc, offset, &the_length);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2014 the_nonreloc += offset;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2015
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2016 c = the_nonreloc;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2017 for (i = 0; i < 4; i++)
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2018 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
2019 Ibyte *newc = (Ibyte *) memchr (c, ':', the_length);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2020 if (!newc)
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2021 break;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2022 newc++;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2023 the_length -= (newc - c);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2024 c = newc;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2025 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2026
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2027 if (i < 4)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2028 return 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2029
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2030 font_charset = c;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2031
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2032 /* For border-glyph use */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
2033 if (!qxestrcasecmp_ascii (font_charset, "symbol"))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2034 font_charset = (const Ibyte *) "western";
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2035
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2036 /* Get code page for the charset */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2037 charset_registry = Fmswindows_charset_registry (charset);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2038 if (!STRINGP (charset_registry))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2039 return 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2040
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2041 return !qxestrcasecmp (XSTRING_DATA (charset_registry), font_charset);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2042 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2043
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2044 /*
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2045
5015
d95c102a96d3 cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents: 4982
diff changeset
2046 #### The following comment is old and probably not applicable any longer.
d95c102a96d3 cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents: 4982
diff changeset
2047
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2048 1. handle standard mapping and inheritance vectors properly in Face-frob-property.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2049 2. finish impl of mswindows-charset-registry.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2050 3. see if everything works under fixup, now that i copied the stuff over.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2051 4. consider generalizing Face-frob-property to frob-specifier.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2052 5. maybe extract some of the flets out of Face-frob-property as useful specifier frobbing.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2053 6. eventually this stuff's got to be checked in!!!!
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2054 */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2055
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2056 static int
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2057 mswindows_font_spec_matches_charset_stage_2 (struct device *d,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2058 Lisp_Object charset,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2059 const Ibyte *nonreloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2060 Lisp_Object reloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2061 Bytecount offset,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2062 Bytecount length)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2063 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2064 const Ibyte *the_nonreloc = nonreloc;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2065 FONTSIGNATURE fs;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2066 FONTSIGNATURE *fsp = &fs;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2067 struct gcpro gcpro1;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2068 Lisp_Object fontsig;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2069 Bytecount the_length = length;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2070 int i;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2071
4353
4143b78d0df0 Merge an old patch of Ben's, involving font instantiation and charsets.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3662
diff changeset
2072 if (NILP (charset))
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2073 return 1;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2074
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2075 if (!the_nonreloc)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2076 the_nonreloc = XSTRING_DATA (reloc);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2077 fixup_internal_substring (nonreloc, reloc, offset, &the_length);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2078 the_nonreloc += offset;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2079
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2080 /* Get the list of Unicode subranges corresponding to the font. This
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2081 is contained inside of FONTSIGNATURE data, obtained by calling
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2082 GetTextCharsetInfo on a font object, which we need to create from the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2083 spec. See if the FONTSIGNATURE data is already cached. If not, get
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2084 it and cache it. */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2085 if (!STRINGP (reloc) || the_nonreloc != XSTRING_DATA (reloc))
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2086 reloc = build_istring (the_nonreloc);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2087 GCPRO1 (reloc);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2088 fontsig = Fgethash (reloc, Vfont_signature_data, Qunbound);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2089
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2090 if (!UNBOUNDP (fontsig))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2091 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2092 fsp = (FONTSIGNATURE *) XOPAQUE_DATA (fontsig);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2093 UNGCPRO;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2094 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2095 else
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2096 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2097 HDC hdc = CreateCompatibleDC (NULL);
4579
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2098 Lisp_Object font_list = Qnil, truename;
5016
2ade80e8c640 enable more warnings and fix them
Ben Wing <ben@xemacs.org>
parents: 5015
diff changeset
2099 HFONT hfont;
4579
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2100
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2101 if (DEVICE_TYPE_P (d, mswindows))
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2102 {
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2103 font_list = DEVICE_MSWINDOWS_FONTLIST (d);
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2104 }
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2105 else if (DEVICE_TYPE_P (d, msprinter))
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2106 {
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2107 font_list = DEVICE_MSPRINTER_FONTLIST (d);
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2108 }
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2109 else
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2110 {
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2111 assert(0);
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2112 }
68f74b080e94 Accept msprinter and mswindows, mswindows_font_spec_matches_charset_stage_2
Aidan Kehoe <kehoea@parhasard.net>
parents: 4353
diff changeset
2113
5016
2ade80e8c640 enable more warnings and fix them
Ben Wing <ben@xemacs.org>
parents: 5015
diff changeset
2114 hfont = create_hfont_from_font_spec (the_nonreloc, hdc, Qnil,
2ade80e8c640 enable more warnings and fix them
Ben Wing <ben@xemacs.org>
parents: 5015
diff changeset
2115 font_list,
2ade80e8c640 enable more warnings and fix them
Ben Wing <ben@xemacs.org>
parents: 5015
diff changeset
2116 ERROR_ME_DEBUG_WARN,
2ade80e8c640 enable more warnings and fix them
Ben Wing <ben@xemacs.org>
parents: 5015
diff changeset
2117 &truename);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2118
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2119 if (!hfont || !(hfont = (HFONT) SelectObject (hdc, hfont)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2120 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2121 nope:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2122 DeleteDC (hdc);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2123 UNGCPRO;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2124 return 0;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2125 }
5024
Ben Wing <ben@xemacs.org>
parents: 5016 5009
diff changeset
2126
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2127 if (GetTextCharsetInfo (hdc, &fs, 0) == DEFAULT_CHARSET)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2128 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2129 SelectObject (hdc, hfont);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2130 goto nope;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2131 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2132 SelectObject (hdc, hfont);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2133 DeleteDC (hdc);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2134 Fputhash (reloc, make_opaque (&fs, sizeof (fs)), Vfont_signature_data);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2135 UNGCPRO;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2136 }
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2137
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2138 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2139 int lowlim, highlim;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2140 int dim, j, cp = -1;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2141
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2142 /* Try to find a Unicode char in the charset. #### This is somewhat
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2143 bogus. See below.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2144
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2145 #### Cache me baby!!!!!!!!!!!!!
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2146 */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2147 get_charset_limits (charset, &lowlim, &highlim);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2148 dim = XCHARSET_DIMENSION (charset);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2149
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2150 if (dim == 1)
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2151 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2152 for (i = lowlim; i <= highlim; i++)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2153 if ((cp = ichar_to_unicode (make_ichar (charset, i, 0))) >= 0)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2154 break;
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2155 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2156 else
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2157 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2158 for (i = lowlim; i <= highlim; i++)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2159 for (j = lowlim; j <= highlim; j++)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2160 if ((cp = ichar_to_unicode (make_ichar (charset, i, j))) >= 0)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2161 break;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2162 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2163
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2164 if (cp < 0)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2165 return 0;
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2166
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2167 /* Check to see, for each subrange supported by the font,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2168 whether the Unicode char is within that subrange. If any match,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2169 the font supports the char (whereby, the charset, bogusly). */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2170
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2171 for (i = 0; i < 128; i++)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2172 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2173 if (fsp->fsUsb[i >> 5] & (1 << (i & 32)))
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2174 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2175 for (j = 0; j < unicode_subrange_table[i].no_subranges; j++)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2176 if (cp >= unicode_subrange_table[i].subranges[j].start &&
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2177 cp <= unicode_subrange_table[i].subranges[j].end)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2178 return 1;
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2179 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2180 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2181
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2182 return 0;
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2183 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2184 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2185
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2186 /*
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2187 Given a truename font spec, does it match CHARSET?
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2188
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2189 We try two stages:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2190
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2191 -- First see if the charset corresponds to one of the predefined Windows
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2192 charsets; if so, we see if the registry (that's the last element of the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2193 font spec) is that same charset. If so, this means that the font is
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2194 specifically designed for the charset, and we prefer it.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2195
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2196 -- However, there are only a limited number of defined Windows charsets,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2197 and new ones aren't being defined; so if we fail the first stage, we find
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2198 a character from the charset with a Unicode equivalent, and see if the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2199 font can display this character. we do that by retrieving the Unicode
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2200 ranges that the font supports, to see if the character comes from that
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2201 subrange.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2202
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2203 #### Note: We really want to be doing all these checks at the character
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2204 level, not the charset level. There's no guarantee that a charset covers
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2205 a single Unicode range. Furthermore, this is extremely wasteful. We
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2206 should be doing this when we're about to redisplay and already have the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2207 Unicode codepoints in hand.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2208 */
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2209
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2210 static int
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2211 mswindows_font_spec_matches_charset (struct device *d, Lisp_Object charset,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2212 const Ibyte *nonreloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2213 Lisp_Object reloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2214 Bytecount offset, Bytecount length,
3662
b880e45ea63b [xemacs-hg @ 2006-11-06 19:35:43 by aidan]
aidan
parents: 3659
diff changeset
2215 enum font_specifier_matchspec_stages stage)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2216 {
5015
d95c102a96d3 cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents: 4982
diff changeset
2217 return stage == STAGE_FINAL ?
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2218 mswindows_font_spec_matches_charset_stage_2 (d, charset, nonreloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2219 reloc, offset, length)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2220 : mswindows_font_spec_matches_charset_stage_1 (d, charset, nonreloc,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2221 reloc, offset, length);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2222 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2223
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2224
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2225 /* Find a font spec that matches font spec FONT and also matches
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2226 (the registry of) CHARSET. */
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2227
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2228 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2229 mswindows_find_charset_font (Lisp_Object device, Lisp_Object font,
3659
98af8a976fc3 [xemacs-hg @ 2006-11-05 22:31:31 by aidan]
aidan
parents: 2527
diff changeset
2230 Lisp_Object charset,
98af8a976fc3 [xemacs-hg @ 2006-11-05 22:31:31 by aidan]
aidan
parents: 2527
diff changeset
2231 enum font_specifier_matchspec_stages stage)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2232 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2233 Lisp_Object fontlist, fonttail;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2234
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2235 /* If FONT specifies a particular charset, this will only list fonts with
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2236 that charset; otherwise, it will list fonts with all charsets. */
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
2237 fontlist = mswindows_font_list (font, device, Qnil);
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2238
5015
d95c102a96d3 cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents: 4982
diff changeset
2239 if (stage == STAGE_INITIAL)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2240 {
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2241 LIST_LOOP (fonttail, fontlist)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2242 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2243 if (mswindows_font_spec_matches_charset_stage_1
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2244 (XDEVICE (device), charset, 0, XCAR (fonttail), 0, -1))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2245 return XCAR (fonttail);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2246 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2247 }
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2248 else
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2249 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2250 LIST_LOOP (fonttail, fontlist)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2251 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2252 if (mswindows_font_spec_matches_charset_stage_2
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2253 (XDEVICE (device), charset, 0, XCAR (fonttail), 0, -1))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2254 return XCAR (fonttail);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2255 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2256 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
2257
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2258 return Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2259 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2260
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261 #endif /* MULE */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2264 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2265 /* non-methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2267
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
2268 static Lisp_Object
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
2269 mswindows_color_list (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2270 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2271 Lisp_Object result = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2272 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
2274 for (i = countof (mswindows_X_color_map); i != 0;)
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
2275 result = Fcons (build_ascstring (mswindows_X_color_map[--i].name), result);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2276
5218
ec2ddc82f10d Use binary search, not linear, for looking up color names, mswindows.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5192
diff changeset
2277 return result;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2278 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2280
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2281 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2282 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2283 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2285 void
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 5024
diff changeset
2286 syms_of_fontcolor_mswindows (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2287 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2288 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2290 void
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 5024
diff changeset
2291 console_type_create_fontcolor_mswindows (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2292 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2293 /* object methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2294 CONSOLE_HAS_METHOD (mswindows, initialize_color_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2295 /* CONSOLE_HAS_METHOD (mswindows, mark_color_instance); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2296 CONSOLE_HAS_METHOD (mswindows, print_color_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2297 CONSOLE_HAS_METHOD (mswindows, finalize_color_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2298 CONSOLE_HAS_METHOD (mswindows, color_instance_equal);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2299 CONSOLE_HAS_METHOD (mswindows, color_instance_hash);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2300 CONSOLE_HAS_METHOD (mswindows, color_instance_rgb_components);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2301 CONSOLE_HAS_METHOD (mswindows, valid_color_name_p);
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
2302 CONSOLE_HAS_METHOD (mswindows, color_list);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2304 CONSOLE_HAS_METHOD (mswindows, initialize_font_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2305 /* CONSOLE_HAS_METHOD (mswindows, mark_font_instance); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2306 CONSOLE_HAS_METHOD (mswindows, print_font_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2307 CONSOLE_HAS_METHOD (mswindows, finalize_font_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2308 CONSOLE_HAS_METHOD (mswindows, font_instance_truename);
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
2309 CONSOLE_HAS_METHOD (mswindows, font_list);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2310 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2311 CONSOLE_HAS_METHOD (mswindows, font_spec_matches_charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2312 CONSOLE_HAS_METHOD (mswindows, find_charset_font);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2313 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2314
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2315 /* Printer methods - delegate most to windows methods,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2316 since graphical objects behave the same way. */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2317
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2318 CONSOLE_INHERITS_METHOD (msprinter, mswindows, initialize_color_instance);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2319 /* CONSOLE_INHERITS_METHOD (msprinter, mswindows, mark_color_instance); */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2320 CONSOLE_INHERITS_METHOD (msprinter, mswindows, print_color_instance);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2321 CONSOLE_INHERITS_METHOD (msprinter, mswindows, finalize_color_instance);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2322 CONSOLE_INHERITS_METHOD (msprinter, mswindows, color_instance_equal);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2323 CONSOLE_INHERITS_METHOD (msprinter, mswindows, color_instance_hash);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2324 CONSOLE_INHERITS_METHOD (msprinter, mswindows, color_instance_rgb_components);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2325 CONSOLE_INHERITS_METHOD (msprinter, mswindows, valid_color_name_p);
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
2326 CONSOLE_INHERITS_METHOD (msprinter, mswindows, color_list);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2327
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2328 CONSOLE_HAS_METHOD (msprinter, initialize_font_instance);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2329 /* CONSOLE_INHERITS_METHOD (msprinter, mswindows, mark_font_instance); */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2330 CONSOLE_INHERITS_METHOD (msprinter, mswindows, print_font_instance);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2331 CONSOLE_INHERITS_METHOD (msprinter, mswindows, finalize_font_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2332 CONSOLE_INHERITS_METHOD (msprinter, mswindows, font_instance_truename);
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2515
diff changeset
2333 CONSOLE_INHERITS_METHOD (msprinter, mswindows, font_list);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2334 #ifdef MULE
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2335 CONSOLE_INHERITS_METHOD (msprinter, mswindows, font_spec_matches_charset);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2336 CONSOLE_INHERITS_METHOD (msprinter, mswindows, find_charset_font);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 430
diff changeset
2337 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2338 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2340 void
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 5024
diff changeset
2341 reinit_vars_of_fontcolor_mswindows (void)
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2342 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2343 #ifdef MULE
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2344 int i;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2345
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2346 unicode_subrange_table = xnew_array_and_zero (unicode_subrange_t, 128);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2347 for (i = 0; i < countof (unicode_subrange_raw_map); i++)
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2348 {
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2349 const unicode_subrange_raw_t *el = &unicode_subrange_raw_map[i];
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2350 if (unicode_subrange_table[el->subrange_bit].subranges == 0)
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2351 unicode_subrange_table[el->subrange_bit].subranges = el;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2352 unicode_subrange_table[el->subrange_bit].no_subranges++;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2353 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2354
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2355 Fclrhash (Vfont_signature_data);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2356 #endif /* MULE */
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2357 }
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2358
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2359 void
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 5024
diff changeset
2360 vars_of_fontcolor_mswindows (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2361 {
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2362 #ifdef MULE
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2363 Vfont_signature_data =
5191
71ee43b8a74d Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents: 5182
diff changeset
2364 make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, Qequal);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2365 staticpro (&Vfont_signature_data);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2366 #endif /* MULE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2367 }