Mercurial > hg > xemacs-beta
comparison src/font-mgr.c @ 5127:a9c41067dd88 ben-lisp-object
more cleanups, terminology clarification, lots of doc work
-------------------- ChangeLog entries follow: --------------------
man/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* internals/internals.texi (Introduction to Allocation):
* internals/internals.texi (Integers and Characters):
* internals/internals.texi (Allocation from Frob Blocks):
* internals/internals.texi (lrecords):
* internals/internals.texi (Low-level allocation):
Rewrite section on allocation of Lisp objects to reflect the new
reality. Remove references to nonexistent XSETINT and XSETCHAR.
modules/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c (allocate_pgconn):
* postgresql/postgresql.c (allocate_pgresult):
* postgresql/postgresql.h (struct Lisp_PGconn):
* postgresql/postgresql.h (struct Lisp_PGresult):
* ldap/eldap.c (allocate_ldap):
* ldap/eldap.h (struct Lisp_LDAP):
Same changes as in src/ dir. See large log there in ChangeLog,
but basically:
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
../hlo/src/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (old_alloc_sized_lcrecord):
* alloc.c (very_old_free_lcrecord):
* alloc.c (copy_lisp_object):
* alloc.c (zero_sized_lisp_object):
* alloc.c (zero_nonsized_lisp_object):
* alloc.c (lisp_object_storage_size):
* alloc.c (free_normal_lisp_object):
* alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC):
* alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT):
* alloc.c (Fcons):
* alloc.c (noseeum_cons):
* alloc.c (make_float):
* alloc.c (make_bignum):
* alloc.c (make_bignum_bg):
* alloc.c (make_ratio):
* alloc.c (make_ratio_bg):
* alloc.c (make_ratio_rt):
* alloc.c (make_bigfloat):
* alloc.c (make_bigfloat_bf):
* alloc.c (size_vector):
* alloc.c (make_compiled_function):
* alloc.c (Fmake_symbol):
* alloc.c (allocate_extent):
* alloc.c (allocate_event):
* alloc.c (make_key_data):
* alloc.c (make_button_data):
* alloc.c (make_motion_data):
* alloc.c (make_process_data):
* alloc.c (make_timeout_data):
* alloc.c (make_magic_data):
* alloc.c (make_magic_eval_data):
* alloc.c (make_eval_data):
* alloc.c (make_misc_user_data):
* alloc.c (Fmake_marker):
* alloc.c (noseeum_make_marker):
* alloc.c (size_string_direct_data):
* alloc.c (make_uninit_string):
* alloc.c (make_string_nocopy):
* alloc.c (mark_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (sweep_lcrecords_1):
* alloc.c (malloced_storage_size):
* buffer.c (allocate_buffer):
* buffer.c (compute_buffer_usage):
* buffer.c (DEFVAR_BUFFER_LOCAL_1):
* buffer.c (nuke_all_buffer_slots):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.h (struct buffer_text):
* buffer.h (struct buffer):
* bytecode.c:
* bytecode.c (make_compiled_function_args):
* bytecode.c (size_compiled_function_args):
* bytecode.h (struct compiled_function_args):
* casetab.c (allocate_case_table):
* casetab.h (struct Lisp_Case_Table):
* charset.h (struct Lisp_Charset):
* chartab.c (fill_char_table):
* chartab.c (Fmake_char_table):
* chartab.c (make_char_table_entry):
* chartab.c (copy_char_table_entry):
* chartab.c (Fcopy_char_table):
* chartab.c (put_char_table):
* chartab.h (struct Lisp_Char_Table_Entry):
* chartab.h (struct Lisp_Char_Table):
* console-gtk-impl.h (struct gtk_device):
* console-gtk-impl.h (struct gtk_frame):
* console-impl.h (struct console):
* console-msw-impl.h (struct Lisp_Devmode):
* console-msw-impl.h (struct mswindows_device):
* console-msw-impl.h (struct msprinter_device):
* console-msw-impl.h (struct mswindows_frame):
* console-msw-impl.h (struct mswindows_dialog_id):
* console-stream-impl.h (struct stream_console):
* console-stream.c (stream_init_console):
* console-tty-impl.h (struct tty_console):
* console-tty-impl.h (struct tty_device):
* console-tty.c (allocate_tty_console_struct):
* console-x-impl.h (struct x_device):
* console-x-impl.h (struct x_frame):
* console.c (allocate_console):
* console.c (nuke_all_console_slots):
* console.c (DEFVAR_CONSOLE_LOCAL_1):
* console.c (common_init_complex_vars_of_console):
* data.c (make_weak_list):
* data.c (make_weak_box):
* data.c (make_ephemeron):
* database.c:
* database.c (struct Lisp_Database):
* database.c (allocate_database):
* database.c (finalize_database):
* device-gtk.c (allocate_gtk_device_struct):
* device-impl.h (struct device):
* device-msw.c:
* device-msw.c (mswindows_init_device):
* device-msw.c (msprinter_init_device):
* device-msw.c (finalize_devmode):
* device-msw.c (allocate_devmode):
* device-tty.c (allocate_tty_device_struct):
* device-x.c (allocate_x_device_struct):
* device.c:
* device.c (nuke_all_device_slots):
* device.c (allocate_device):
* dialog-msw.c (handle_question_dialog_box):
* elhash.c:
* elhash.c (struct Lisp_Hash_Table):
* elhash.c (finalize_hash_table):
* elhash.c (make_general_lisp_hash_table):
* elhash.c (Fcopy_hash_table):
* elhash.h (htentry):
* emacs.c (main_1):
* eval.c:
* eval.c (size_multiple_value):
* event-stream.c (finalize_command_builder):
* event-stream.c (allocate_command_builder):
* event-stream.c (free_command_builder):
* event-stream.c (event_stream_generate_wakeup):
* event-stream.c (event_stream_resignal_wakeup):
* event-stream.c (event_stream_disable_wakeup):
* event-stream.c (event_stream_wakeup_pending_p):
* events.h (struct Lisp_Timeout):
* events.h (struct command_builder):
* extents-impl.h:
* extents-impl.h (struct extent_auxiliary):
* extents-impl.h (struct extent_info):
* extents-impl.h (set_extent_no_chase_aux_field):
* extents-impl.h (set_extent_no_chase_normal_field):
* extents.c:
* extents.c (gap_array_marker):
* extents.c (gap_array):
* extents.c (extent_list_marker):
* extents.c (extent_list):
* extents.c (stack_of_extents):
* extents.c (gap_array_make_marker):
* extents.c (extent_list_make_marker):
* extents.c (allocate_extent_list):
* extents.c (SLOT):
* extents.c (mark_extent_auxiliary):
* extents.c (allocate_extent_auxiliary):
* extents.c (attach_extent_auxiliary):
* extents.c (size_gap_array):
* extents.c (finalize_extent_info):
* extents.c (allocate_extent_info):
* extents.c (uninit_buffer_extents):
* extents.c (allocate_soe):
* extents.c (copy_extent):
* extents.c (vars_of_extents):
* extents.h:
* faces.c (allocate_face):
* faces.h (struct Lisp_Face):
* faces.h (struct face_cachel):
* file-coding.c:
* file-coding.c (finalize_coding_system):
* file-coding.c (sizeof_coding_system):
* file-coding.c (Fcopy_coding_system):
* file-coding.h (struct Lisp_Coding_System):
* file-coding.h (MARKED_SLOT):
* fns.c (size_bit_vector):
* font-mgr.c:
* font-mgr.c (finalize_fc_pattern):
* font-mgr.c (print_fc_pattern):
* font-mgr.c (Ffc_pattern_p):
* font-mgr.c (Ffc_pattern_create):
* font-mgr.c (Ffc_name_parse):
* font-mgr.c (Ffc_name_unparse):
* font-mgr.c (Ffc_pattern_duplicate):
* font-mgr.c (Ffc_pattern_add):
* font-mgr.c (Ffc_pattern_del):
* font-mgr.c (Ffc_pattern_get):
* font-mgr.c (fc_config_create_using):
* font-mgr.c (fc_strlist_to_lisp_using):
* font-mgr.c (fontset_to_list):
* font-mgr.c (Ffc_config_p):
* font-mgr.c (Ffc_config_up_to_date):
* font-mgr.c (Ffc_config_build_fonts):
* font-mgr.c (Ffc_config_get_cache):
* font-mgr.c (Ffc_config_get_fonts):
* font-mgr.c (Ffc_config_set_current):
* font-mgr.c (Ffc_config_get_blanks):
* font-mgr.c (Ffc_config_get_rescan_interval):
* font-mgr.c (Ffc_config_set_rescan_interval):
* font-mgr.c (Ffc_config_app_font_add_file):
* font-mgr.c (Ffc_config_app_font_add_dir):
* font-mgr.c (Ffc_config_app_font_clear):
* font-mgr.c (size):
* font-mgr.c (Ffc_config_substitute):
* font-mgr.c (Ffc_font_render_prepare):
* font-mgr.c (Ffc_font_match):
* font-mgr.c (Ffc_font_sort):
* font-mgr.c (finalize_fc_config):
* font-mgr.c (print_fc_config):
* font-mgr.h:
* font-mgr.h (struct fc_pattern):
* font-mgr.h (XFC_PATTERN):
* font-mgr.h (struct fc_config):
* font-mgr.h (XFC_CONFIG):
* frame-gtk.c (allocate_gtk_frame_struct):
* frame-impl.h (struct frame):
* frame-msw.c (mswindows_init_frame_1):
* frame-x.c (allocate_x_frame_struct):
* frame.c (nuke_all_frame_slots):
* frame.c (allocate_frame_core):
* gc.c:
* gc.c (GC_CHECK_NOT_FREE):
* glyphs.c (finalize_image_instance):
* glyphs.c (allocate_image_instance):
* glyphs.c (Fcolorize_image_instance):
* glyphs.c (allocate_glyph):
* glyphs.c (unmap_subwindow_instance_cache_mapper):
* glyphs.c (register_ignored_expose):
* glyphs.h (struct Lisp_Image_Instance):
* glyphs.h (struct Lisp_Glyph):
* glyphs.h (struct glyph_cachel):
* glyphs.h (struct expose_ignore):
* gui.c (allocate_gui_item):
* gui.h (struct Lisp_Gui_Item):
* keymap.c (struct Lisp_Keymap):
* keymap.c (make_keymap):
* lisp.h:
* lisp.h (struct Lisp_String_Direct_Data):
* lisp.h (struct Lisp_String_Indirect_Data):
* lisp.h (struct Lisp_Vector):
* lisp.h (struct Lisp_Bit_Vector):
* lisp.h (DECLARE_INLINE_LISP_BIT_VECTOR):
* lisp.h (struct weak_box):
* lisp.h (struct ephemeron):
* lisp.h (struct weak_list):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER):
* lrecord.h (struct lcrecord_list):
* lstream.c (finalize_lstream):
* lstream.c (sizeof_lstream):
* lstream.c (Lstream_new):
* lstream.c (Lstream_delete):
* lstream.h (struct lstream):
* marker.c:
* marker.c (finalize_marker):
* marker.c (compute_buffer_marker_usage):
* mule-charset.c:
* mule-charset.c (make_charset):
* mule-charset.c (compute_charset_usage):
* objects-impl.h (struct Lisp_Color_Instance):
* objects-impl.h (struct Lisp_Font_Instance):
* objects-tty-impl.h (struct tty_color_instance_data):
* objects-tty-impl.h (struct tty_font_instance_data):
* objects-tty.c (tty_initialize_color_instance):
* objects-tty.c (tty_initialize_font_instance):
* objects.c (finalize_color_instance):
* objects.c (Fmake_color_instance):
* objects.c (finalize_font_instance):
* objects.c (Fmake_font_instance):
* objects.c (reinit_vars_of_objects):
* opaque.c:
* opaque.c (sizeof_opaque):
* opaque.c (make_opaque_ptr):
* opaque.c (free_opaque_ptr):
* opaque.h:
* opaque.h (Lisp_Opaque):
* opaque.h (Lisp_Opaque_Ptr):
* print.c (printing_unreadable_lcrecord):
* print.c (external_object_printer):
* print.c (debug_p4):
* process.c (finalize_process):
* process.c (make_process_internal):
* procimpl.h (struct Lisp_Process):
* rangetab.c (Fmake_range_table):
* rangetab.c (Fcopy_range_table):
* rangetab.h (struct Lisp_Range_Table):
* scrollbar.c:
* scrollbar.c (create_scrollbar_instance):
* scrollbar.c (compute_scrollbar_instance_usage):
* scrollbar.h (struct scrollbar_instance):
* specifier.c (finalize_specifier):
* specifier.c (sizeof_specifier):
* specifier.c (set_specifier_caching):
* specifier.h (struct Lisp_Specifier):
* specifier.h (struct specifier_caching):
* symeval.h:
* symeval.h (SYMBOL_VALUE_MAGIC_P):
* symeval.h (DEFVAR_SYMVAL_FWD):
* symsinit.h:
* syntax.c (init_buffer_syntax_cache):
* syntax.h (struct syntax_cache):
* toolbar.c:
* toolbar.c (allocate_toolbar_button):
* toolbar.c (update_toolbar_button):
* toolbar.h (struct toolbar_button):
* tooltalk.c (struct Lisp_Tooltalk_Message):
* tooltalk.c (make_tooltalk_message):
* tooltalk.c (struct Lisp_Tooltalk_Pattern):
* tooltalk.c (make_tooltalk_pattern):
* ui-gtk.c:
* ui-gtk.c (allocate_ffi_data):
* ui-gtk.c (emacs_gtk_object_finalizer):
* ui-gtk.c (allocate_emacs_gtk_object_data):
* ui-gtk.c (allocate_emacs_gtk_boxed_data):
* ui-gtk.h:
* window-impl.h (struct window):
* window-impl.h (struct window_mirror):
* window.c (finalize_window):
* window.c (allocate_window):
* window.c (new_window_mirror):
* window.c (mark_window_as_deleted):
* window.c (make_dummy_parent):
* window.c (compute_window_mirror_usage):
* window.c (compute_window_usage):
Overall point of this change and previous ones in this repository:
(1) Introduce new, clearer terminology: everything other than int
or char is a "record" object, which comes in two types: "normal
objects" and "frob-block objects". Fix up all places that
referred to frob-block objects as "simple", "basic", etc.
(2) Provide an advertised interface for doing operations on Lisp
objects, including creating new types, that is clean and
consistent in its naming, uses the above-referenced terms and
avoids referencing "lrecords", "old lcrecords", etc., which should
hide under the surface.
(3) Make the size_in_bytes and finalizer methods take a
Lisp_Object rather than a void * for consistency with other methods.
(4) Separate finalizer method into finalizer and disksaver, so
that normal finalize methods don't have to worry about disksaving.
Other specifics:
(1) Renaming:
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
implementation->basic_p -> implementation->frob_block_p
ALLOCATE_FIXED_TYPE_AND_SET_IMPL -> ALLOC_FROB_BLOCK_LISP_OBJECT
*FCCONFIG*, wrap_fcconfig -> *FC_CONFIG*, wrap_fc_config
*FCPATTERN*, wrap_fcpattern -> *FC_PATTERN*, wrap_fc_pattern
(the last two changes make the naming of these macros consistent
with the naming of all other macros, since the objects are named
fc-config and fc-pattern with a hyphen)
(2) Lots of documentation fixes in lrecord.h.
(3) Eliminate macros for copying, freeing, zeroing objects, getting
their storage size. Instead, new functions:
zero_sized_lisp_object()
zero_nonsized_lisp_object()
lisp_object_storage_size()
free_normal_lisp_object()
(copy_lisp_object() already exists)
LISP_OBJECT_FROB_BLOCK_P() (actually a macro)
Eliminated:
free_lrecord()
zero_lrecord()
copy_lrecord()
copy_sized_lrecord()
old_copy_lcrecord()
old_copy_sized_lcrecord()
old_zero_lcrecord()
old_zero_sized_lcrecord()
LISP_OBJECT_STORAGE_SIZE()
COPY_SIZED_LISP_OBJECT()
COPY_SIZED_LCRECORD()
COPY_LISP_OBJECT()
ZERO_LISP_OBJECT()
FREE_LISP_OBJECT()
(4) Catch the remaining places where lrecord stuff was used directly
and use the advertised interface, e.g. alloc_sized_lrecord() ->
ALLOC_SIZED_LISP_OBJECT().
(5) Make certain statically-declared pseudo-objects
(buffer_local_flags, console_local_flags) have their lheader
initialized correctly, so things like copy_lisp_object() can work
on them. Make extent_auxiliary_defaults a proper heap object
Vextent_auxiliary_defaults, and make extent auxiliaries dumpable
so that this object can be dumped. allocate_extent_auxiliary()
now just creates the object, and attach_extent_auxiliary()
creates an extent auxiliary and attaches to an extent, like the
old allocate_extent_auxiliary().
(6) Create EXTENT_AUXILIARY_SLOTS macro, similar to the foo-slots.h
files but in a macro instead of a file. The purpose is to avoid
duplication when iterating over all the slots in an extent auxiliary.
Use it.
(7) In lstream.c, don't zero out object after allocation because
allocation routines take care of this.
(8) In marker.c, fix a mistake in computing marker overhead.
(9) In print.c, clean up printing_unreadable_lcrecord(),
external_object_printer() to avoid lots of ifdef NEW_GC's.
(10) Separate toolbar-button allocation into a separate
allocate_toolbar_button() function for use in the example code
in lrecord.h.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Fri, 05 Mar 2010 04:08:17 -0600 |
parents | b5df3737028a |
children | f965e31a35f0 |
comparison
equal
deleted
inserted
replaced
5126:2a462149bd6a | 5127:a9c41067dd88 |
---|---|
1 /* Lisp font handling implementation for X with Xft. | 1 /* Lisp font handling implementation for X with Xft. |
2 | 2 |
3 Copyright (C) 2003 Eric Knauel and Matthias Neubauer | 3 Copyright (C) 2003 Eric Knauel and Matthias Neubauer |
4 Copyright (C) 2005 Eric Knauel | 4 Copyright (C) 2005 Eric Knauel |
5 Copyright (C) 2004-2009 Free Software Foundation, Inc. | 5 Copyright (C) 2004-2009 Free Software Foundation, Inc. |
6 Copyright (C) 2010 Ben Wing. | |
6 | 7 |
7 Authors: Eric Knauel <knauel@informatik.uni-tuebingen.de> | 8 Authors: Eric Knauel <knauel@informatik.uni-tuebingen.de> |
8 Matthias Neubauer <neubauer@informatik.uni-freiburg.de> | 9 Matthias Neubauer <neubauer@informatik.uni-freiburg.de> |
9 Stephen J. Turnbull <stephen@xemacs.org> | 10 Stephen J. Turnbull <stephen@xemacs.org> |
10 Created: 27 Oct 2003 | 11 Created: 27 Oct 2003 |
91 /**************************************************************** | 92 /**************************************************************** |
92 * FcPattern objects * | 93 * FcPattern objects * |
93 ****************************************************************/ | 94 ****************************************************************/ |
94 | 95 |
95 static void | 96 static void |
96 finalize_fc_pattern (void *header) | 97 finalize_fc_pattern (Lisp_Object obj) |
97 { | 98 { |
98 struct fc_pattern *p = (struct fc_pattern *) header; | 99 struct fc_pattern *p = XFC_PATTERN (obj); |
99 if (p->fcpatPtr) | 100 if (p->fcpatPtr) |
100 { | 101 { |
101 FcPatternDestroy (p->fcpatPtr); | 102 FcPatternDestroy (p->fcpatPtr); |
102 p->fcpatPtr = 0; | 103 p->fcpatPtr = 0; |
103 } | 104 } |
105 | 106 |
106 static void | 107 static void |
107 print_fc_pattern (Lisp_Object obj, Lisp_Object printcharfun, | 108 print_fc_pattern (Lisp_Object obj, Lisp_Object printcharfun, |
108 int UNUSED(escapeflag)) | 109 int UNUSED(escapeflag)) |
109 { | 110 { |
110 struct fc_pattern *c = XFCPATTERN (obj); | 111 struct fc_pattern *c = XFC_PATTERN (obj); |
111 if (print_readably) | 112 if (print_readably) |
112 printing_unreadable_object ("#<fc-pattern 0x%x>", c->header.uid); | 113 printing_unreadable_object ("#<fc-pattern 0x%x>", c->header.uid); |
113 write_fmt_string (printcharfun, "#<fc-pattern 0x%x>", c->header.uid); | 114 write_fmt_string (printcharfun, "#<fc-pattern 0x%x>", c->header.uid); |
114 } | 115 } |
115 | 116 |
224 DEFUN("fc-pattern-p", Ffc_pattern_p, 1, 1, 0, /* | 225 DEFUN("fc-pattern-p", Ffc_pattern_p, 1, 1, 0, /* |
225 Returns t if OBJECT is of type fc-pattern, nil otherwise. | 226 Returns t if OBJECT is of type fc-pattern, nil otherwise. |
226 */ | 227 */ |
227 (object)) | 228 (object)) |
228 { | 229 { |
229 return FCPATTERNP(object) ? Qt : Qnil; | 230 return FC_PATTERNP(object) ? Qt : Qnil; |
230 } | 231 } |
231 | 232 |
232 DEFUN("fc-pattern-create", Ffc_pattern_create, 0, 0, 0, /* | 233 DEFUN("fc-pattern-create", Ffc_pattern_create, 0, 0, 0, /* |
233 Return a new, empty fc-pattern object. | 234 Return a new, empty fc-pattern object. |
234 */ | 235 */ |
235 ()) | 236 ()) |
236 { | 237 { |
237 fc_pattern *fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); | 238 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
238 | 239 |
239 fcpat->fcpatPtr = FcPatternCreate (); | 240 fcpat->fcpatPtr = FcPatternCreate (); |
240 return wrap_fcpattern (fcpat); | 241 return wrap_fc_pattern (fcpat); |
241 } | 242 } |
242 | 243 |
243 DEFUN("fc-name-parse", Ffc_name_parse, 1, 1, 0, /* | 244 DEFUN("fc-name-parse", Ffc_name_parse, 1, 1, 0, /* |
244 Parse an Fc font name and return its representation as a fc pattern object. | 245 Parse an Fc font name and return its representation as a fc pattern object. |
245 */ | 246 */ |
246 (name)) | 247 (name)) |
247 { | 248 { |
248 fc_pattern *fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); | 249 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
249 | 250 |
250 CHECK_STRING (name); | 251 CHECK_STRING (name); |
251 | 252 |
252 fcpat->fcpatPtr = FcNameParse ((FcChar8 *) extract_fcapi_string (name)); | 253 fcpat->fcpatPtr = FcNameParse ((FcChar8 *) extract_fcapi_string (name)); |
253 return wrap_fcpattern (fcpat); | 254 return wrap_fc_pattern (fcpat); |
254 } | 255 } |
255 | 256 |
256 /* #### Ga-a-ack! Xft's similar function is actually a different API. | 257 /* #### Ga-a-ack! Xft's similar function is actually a different API. |
257 We provide both. */ | 258 We provide both. */ |
258 DEFUN("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /* | 259 DEFUN("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /* |
260 */ | 261 */ |
261 (pattern)) | 262 (pattern)) |
262 { | 263 { |
263 FcChar8 *name; | 264 FcChar8 *name; |
264 Lisp_Object result; | 265 Lisp_Object result; |
265 CHECK_FCPATTERN(pattern); | 266 CHECK_FC_PATTERN(pattern); |
266 name = FcNameUnparse (XFCPATTERN_PTR (pattern)); | 267 name = FcNameUnparse (XFC_PATTERN_PTR (pattern)); |
267 result = build_fcapi_string (name); | 268 result = build_fcapi_string (name); |
268 xfree (name); | 269 xfree (name); |
269 return result; | 270 return result; |
270 } | 271 } |
271 | 272 |
273 Make a copy of the fc pattern object PATTERN and return it. | 274 Make a copy of the fc pattern object PATTERN and return it. |
274 */ | 275 */ |
275 (pattern)) | 276 (pattern)) |
276 { | 277 { |
277 struct fc_pattern *copy = NULL; | 278 struct fc_pattern *copy = NULL; |
278 CHECK_FCPATTERN (pattern); | 279 CHECK_FC_PATTERN (pattern); |
279 | 280 |
280 copy = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); | 281 copy = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
281 copy->fcpatPtr = FcPatternDuplicate (XFCPATTERN_PTR (pattern)); | 282 copy->fcpatPtr = FcPatternDuplicate (XFC_PATTERN_PTR (pattern)); |
282 return wrap_fcpattern (copy); | 283 return wrap_fc_pattern (copy); |
283 } | 284 } |
284 | 285 |
285 DEFUN("fc-pattern-add", Ffc_pattern_add, 3, 3, 0, /* | 286 DEFUN("fc-pattern-add", Ffc_pattern_add, 3, 3, 0, /* |
286 Add attributes to the pattern object PATTERN. PROPERTY is a string naming | 287 Add attributes to the pattern object PATTERN. PROPERTY is a string naming |
287 the attribute to add, VALUE the value for this attribute. | 288 the attribute to add, VALUE the value for this attribute. |
293 { | 294 { |
294 Bool res = 0; | 295 Bool res = 0; |
295 const Extbyte *obj; | 296 const Extbyte *obj; |
296 FcPattern *fcpat; | 297 FcPattern *fcpat; |
297 | 298 |
298 CHECK_FCPATTERN (pattern); | 299 CHECK_FC_PATTERN (pattern); |
299 CHECK_STRING (property); | 300 CHECK_STRING (property); |
300 | 301 |
301 obj = fc_intern (property); | 302 obj = fc_intern (property); |
302 fcpat = XFCPATTERN_PTR (pattern); | 303 fcpat = XFC_PATTERN_PTR (pattern); |
303 | 304 |
304 if (STRINGP(value)) | 305 if (STRINGP(value)) |
305 { | 306 { |
306 FcChar8 *str = (FcChar8 *) extract_fcapi_string (value); | 307 FcChar8 *str = (FcChar8 *) extract_fcapi_string (value); |
307 res = FcPatternAddString (fcpat, obj, str); | 308 res = FcPatternAddString (fcpat, obj, str); |
328 */ | 329 */ |
329 (pattern, property)) | 330 (pattern, property)) |
330 { | 331 { |
331 Bool res; | 332 Bool res; |
332 | 333 |
333 CHECK_FCPATTERN(pattern); | 334 CHECK_FC_PATTERN(pattern); |
334 CHECK_STRING(property); | 335 CHECK_STRING(property); |
335 | 336 |
336 res = FcPatternDel(XFCPATTERN_PTR(pattern), extract_fcapi_string (property)); | 337 res = FcPatternDel(XFC_PATTERN_PTR(pattern), extract_fcapi_string (property)); |
337 return res ? Qt : Qnil; | 338 return res ? Qt : Qnil; |
338 } | 339 } |
339 | 340 |
340 /* Generic interface to FcPatternGet() | 341 /* Generic interface to FcPatternGet() |
341 * Don't support the losing symbol-for-property interface. | 342 * Don't support the losing symbol-for-property interface. |
421 FcValue fc_value; | 422 FcValue fc_value; |
422 | 423 |
423 /* | 424 /* |
424 process arguments | 425 process arguments |
425 */ | 426 */ |
426 CHECK_FCPATTERN (pattern); | 427 CHECK_FC_PATTERN (pattern); |
427 | 428 |
428 #if 0 | 429 #if 0 |
429 /* Don't support the losing symbol-for-property interface. */ | 430 /* Don't support the losing symbol-for-property interface. */ |
430 property = SYMBOLP (property) ? symbol_name (XSYMBOL (property)) : property; | 431 property = SYMBOLP (property) ? symbol_name (XSYMBOL (property)) : property; |
431 #endif | 432 #endif |
445 | 446 |
446 if (!NILP (id)) CHECK_NATNUM (id); | 447 if (!NILP (id)) CHECK_NATNUM (id); |
447 if (!NILP (type)) CHECK_SYMBOL (type); | 448 if (!NILP (type)) CHECK_SYMBOL (type); |
448 | 449 |
449 /* get property */ | 450 /* get property */ |
450 fc_result = FcPatternGet (XFCPATTERN_PTR (pattern), | 451 fc_result = FcPatternGet (XFC_PATTERN_PTR (pattern), |
451 fc_property, | 452 fc_property, |
452 NILP (id) ? 0 : XINT(id), | 453 NILP (id) ? 0 : XINT(id), |
453 &fc_value); | 454 &fc_value); |
454 | 455 |
455 switch (fc_result) | 456 switch (fc_result) |
513 Lisp_Object configs = XWEAK_LIST_LIST (Vfc_config_weak_list); | 514 Lisp_Object configs = XWEAK_LIST_LIST (Vfc_config_weak_list); |
514 | 515 |
515 /* Linear search: fc_configs are not going to multiply like conses. */ | 516 /* Linear search: fc_configs are not going to multiply like conses. */ |
516 { | 517 { |
517 LIST_LOOP_2 (cfg, configs) | 518 LIST_LOOP_2 (cfg, configs) |
518 if (fc == XFCCONFIG_PTR (cfg)) | 519 if (fc == XFC_CONFIG_PTR (cfg)) |
519 return cfg; | 520 return cfg; |
520 } | 521 } |
521 | 522 |
522 { | 523 { |
523 fc_config *fccfg = XFCCONFIG (ALLOC_LISP_OBJECT (fc_config)); | 524 fc_config *fccfg = XFC_CONFIG (ALLOC_NORMAL_LISP_OBJECT (fc_config)); |
524 fccfg->fccfgPtr = fc; | 525 fccfg->fccfgPtr = fc; |
525 configs = Fcons (wrap_fcconfig (fccfg), configs); | 526 configs = Fcons (wrap_fc_config (fccfg), configs); |
526 XWEAK_LIST_LIST (Vfc_config_weak_list) = configs; | 527 XWEAK_LIST_LIST (Vfc_config_weak_list) = configs; |
527 return wrap_fcconfig (fccfg); | 528 return wrap_fc_config (fccfg); |
528 } | 529 } |
529 } | 530 } |
530 | 531 |
531 static Lisp_Object | 532 static Lisp_Object |
532 fc_strlist_to_lisp_using (FcStrList * (*getter) (FcConfig *), | 533 fc_strlist_to_lisp_using (FcStrList * (*getter) (FcConfig *), |
534 { | 535 { |
535 FcChar8 *thing; | 536 FcChar8 *thing; |
536 Lisp_Object value = Qnil; | 537 Lisp_Object value = Qnil; |
537 FcStrList *thing_list; | 538 FcStrList *thing_list; |
538 | 539 |
539 CHECK_FCCONFIG (config); | 540 CHECK_FC_CONFIG (config); |
540 thing_list = (*getter) (XFCCONFIG_PTR(config)); | 541 thing_list = (*getter) (XFC_CONFIG_PTR(config)); |
541 /* Yes, we need to do this check -- sheesh, Keith! */ | 542 /* Yes, we need to do this check -- sheesh, Keith! */ |
542 if (!thing_list) | 543 if (!thing_list) |
543 return Qnil; | 544 return Qnil; |
544 while ((thing = FcStrListNext (thing_list))) | 545 while ((thing = FcStrListNext (thing_list))) |
545 value = Fcons (build_fcapi_string (thing), value); | 546 value = Fcons (build_fcapi_string (thing), value); |
557 /* #### improve this error message */ | 558 /* #### improve this error message */ |
558 if (!fontset) | 559 if (!fontset) |
559 invalid_state ("failed to create FcFontSet", Qunbound); | 560 invalid_state ("failed to create FcFontSet", Qunbound); |
560 for (idx = 0; idx < fontset->nfont; ++idx) | 561 for (idx = 0; idx < fontset->nfont; ++idx) |
561 { | 562 { |
562 fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); | 563 fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
563 fcpat->fcpatPtr = FcPatternDuplicate (fontset->fonts[idx]); | 564 fcpat->fcpatPtr = FcPatternDuplicate (fontset->fonts[idx]); |
564 fontlist = Fcons (wrap_fcpattern(fcpat), fontlist); | 565 fontlist = Fcons (wrap_fc_pattern(fcpat), fontlist); |
565 } | 566 } |
566 if (destroyp) | 567 if (destroyp) |
567 FcFontSetDestroy (fontset); | 568 FcFontSetDestroy (fontset); |
568 return fontlist; | 569 return fontlist; |
569 } | 570 } |
571 DEFUN("fc-config-p", Ffc_config_p, 1, 1, 0, /* | 572 DEFUN("fc-config-p", Ffc_config_p, 1, 1, 0, /* |
572 Returns t if OBJECT is of type fc-config, nil otherwise. | 573 Returns t if OBJECT is of type fc-config, nil otherwise. |
573 */ | 574 */ |
574 (object)) | 575 (object)) |
575 { | 576 { |
576 return FCCONFIGP (object) ? Qt : Qnil; | 577 return FC_CONFIGP (object) ? Qt : Qnil; |
577 } | 578 } |
578 | 579 |
579 DEFUN("fc-config-create", Ffc_config_create, 0, 0, 0, /* | 580 DEFUN("fc-config-create", Ffc_config_create, 0, 0, 0, /* |
580 -- Function: FcConfig *FcConfigCreate (void) | 581 -- Function: FcConfig *FcConfigCreate (void) |
581 Creates an empty configuration. */ | 582 Creates an empty configuration. */ |
604 -- Function: FcBool FcConfigUptoDate (FcConfig *config) | 605 -- Function: FcBool FcConfigUptoDate (FcConfig *config) |
605 Checks all of the files related to 'config' and returns whether the | 606 Checks all of the files related to 'config' and returns whether the |
606 in-memory version is in sync with the disk version. */ | 607 in-memory version is in sync with the disk version. */ |
607 (config)) | 608 (config)) |
608 { | 609 { |
609 CHECK_FCCONFIG (config); | 610 CHECK_FC_CONFIG (config); |
610 return FcConfigUptoDate (XFCCONFIG_PTR (config)) == FcFalse ? Qnil : Qt; | 611 return FcConfigUptoDate (XFC_CONFIG_PTR (config)) == FcFalse ? Qnil : Qt; |
611 } | 612 } |
612 | 613 |
613 DEFUN("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /* | 614 DEFUN("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /* |
614 -- Function: FcBool FcConfigBuildFonts (FcConfig *config) | 615 -- Function: FcBool FcConfigBuildFonts (FcConfig *config) |
615 Builds the set of available fonts for the given configuration. | 616 Builds the set of available fonts for the given configuration. |
617 indeterminate effects. Returns FcFalse if this operation runs out | 618 indeterminate effects. Returns FcFalse if this operation runs out |
618 of memory. | 619 of memory. |
619 XEmacs: signal out-of-memory, or return nil on success. */ | 620 XEmacs: signal out-of-memory, or return nil on success. */ |
620 (config)) | 621 (config)) |
621 { | 622 { |
622 CHECK_FCCONFIG (config); | 623 CHECK_FC_CONFIG (config); |
623 if (FcConfigBuildFonts (XFCCONFIG_PTR (config)) == FcFalse) | 624 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) |
624 out_of_memory ("FcConfigBuildFonts failed", config); | 625 out_of_memory ("FcConfigBuildFonts failed", config); |
625 return Qnil; | 626 return Qnil; |
626 } | 627 } |
627 | 628 |
628 DEFUN("fc-config-get-config-dirs", Ffc_config_get_config_dirs, 1, 1, 0, /* | 629 DEFUN("fc-config-get-config-dirs", Ffc_config_get_config_dirs, 1, 1, 0, /* |
659 -- Function: char *FcConfigGetCache (FcConfig *config) | 660 -- Function: char *FcConfigGetCache (FcConfig *config) |
660 Returns the name of the file used to store per-user font | 661 Returns the name of the file used to store per-user font |
661 information. */ | 662 information. */ |
662 (config)) | 663 (config)) |
663 { | 664 { |
664 CHECK_FCCONFIG (config); | 665 CHECK_FC_CONFIG (config); |
665 /* Surely FcConfigGetCache just casts an FcChar8* to char*. */ | 666 /* Surely FcConfigGetCache just casts an FcChar8* to char*. */ |
666 return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFCCONFIG_PTR (config))); | 667 return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFC_CONFIG_PTR (config))); |
667 } | 668 } |
668 | 669 |
669 DEFUN("fc-config-get-fonts", Ffc_config_get_fonts, 2, 2, 0, /* | 670 DEFUN("fc-config-get-fonts", Ffc_config_get_fonts, 2, 2, 0, /* |
670 -- Function: FcFontSet *FcConfigGetFonts (FcConfig *config, FcSetName set) | 671 -- Function: FcFontSet *FcConfigGetFonts (FcConfig *config, FcSetName set) |
671 Returns one of the two sets of fonts from the configuration as | 672 Returns one of the two sets of fonts from the configuration as |
678 (config, set)) | 679 (config, set)) |
679 { | 680 { |
680 FcSetName name = FcSetSystem; | 681 FcSetName name = FcSetSystem; |
681 FcFontSet *fs = NULL; | 682 FcFontSet *fs = NULL; |
682 | 683 |
683 CHECK_FCCONFIG (config); | 684 CHECK_FC_CONFIG (config); |
684 CHECK_SYMBOL (set); | 685 CHECK_SYMBOL (set); |
685 | 686 |
686 if (EQ (set, intern ("fc-set-system"))) | 687 if (EQ (set, intern ("fc-set-system"))) |
687 name = FcSetSystem; | 688 name = FcSetSystem; |
688 else if (EQ (set, intern ("fc-set-application"))) | 689 else if (EQ (set, intern ("fc-set-application"))) |
689 name = FcSetApplication; | 690 name = FcSetApplication; |
690 else | 691 else |
691 wtaerror ("must be in (fc-set-system fc-set-application)", set); | 692 wtaerror ("must be in (fc-set-system fc-set-application)", set); |
692 | 693 |
693 fs = FcConfigGetFonts (XFCCONFIG_PTR (config), name); | 694 fs = FcConfigGetFonts (XFC_CONFIG_PTR (config), name); |
694 return fs ? fontset_to_list (fs, DestroyNo) : Qnil; | 695 return fs ? fontset_to_list (fs, DestroyNo) : Qnil; |
695 } | 696 } |
696 | 697 |
697 DEFUN("fc-config-set-current", Ffc_config_set_current, 1, 1, 0, /* | 698 DEFUN("fc-config-set-current", Ffc_config_set_current, 1, 1, 0, /* |
698 -- Function: FcBool FcConfigSetCurrent (FcConfig *config) | 699 -- Function: FcBool FcConfigSetCurrent (FcConfig *config) |
702 XEmacs: signals out-of-memory if FcConfigBuildFonts fails, or args-out-of-range | 703 XEmacs: signals out-of-memory if FcConfigBuildFonts fails, or args-out-of-range |
703 if the resulting FcConfig has no fonts (which would crash XEmacs if installed). | 704 if the resulting FcConfig has no fonts (which would crash XEmacs if installed). |
704 */ | 705 */ |
705 (config)) | 706 (config)) |
706 { | 707 { |
707 CHECK_FCCONFIG (config); | 708 CHECK_FC_CONFIG (config); |
708 /* *sigh* "Success" DOES NOT mean you have any fonts available. It is | 709 /* *sigh* "Success" DOES NOT mean you have any fonts available. It is |
709 easy to crash fontconfig, and XEmacs with it. Without the following | 710 easy to crash fontconfig, and XEmacs with it. Without the following |
710 check, this will do it: | 711 check, this will do it: |
711 (progn | 712 (progn |
712 (fc-config-set-current (fc-config-create)) | 713 (fc-config-set-current (fc-config-create)) |
713 (set-face-font 'default "serif-12")) | 714 (set-face-font 'default "serif-12")) |
714 */ | 715 */ |
715 | 716 |
716 if (FcConfigBuildFonts (XFCCONFIG_PTR (config)) == FcFalse) | 717 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) |
717 out_of_memory ("FcConfigBuildFonts failed", config); | 718 out_of_memory ("FcConfigBuildFonts failed", config); |
718 /* #### We'd like to avoid this consing, and FcConfigGetFonts sometimes | 719 /* #### We'd like to avoid this consing, and FcConfigGetFonts sometimes |
719 returns NULL, but it doesn't always. This will do for now .... */ | 720 returns NULL, but it doesn't always. This will do for now .... */ |
720 if (NILP (Ffc_config_get_fonts (config, intern ("fc-set-system"))) | 721 if (NILP (Ffc_config_get_fonts (config, intern ("fc-set-system"))) |
721 && NILP (Ffc_config_get_fonts (config, intern ("fc-set-application")))) | 722 && NILP (Ffc_config_get_fonts (config, intern ("fc-set-application")))) |
722 signal_error (intern ("args-out-of-range"), "no fonts found", config); | 723 signal_error (intern ("args-out-of-range"), "no fonts found", config); |
723 /* Should never happen, but I don't trust Keith anymore .... */ | 724 /* Should never happen, but I don't trust Keith anymore .... */ |
724 if (FcConfigSetCurrent (XFCCONFIG_PTR (config)) == FcFalse) | 725 if (FcConfigSetCurrent (XFC_CONFIG_PTR (config)) == FcFalse) |
725 out_of_memory ("FcConfigBuildFonts failed in set", config); | 726 out_of_memory ("FcConfigBuildFonts failed in set", config); |
726 return Qnil; | 727 return Qnil; |
727 } | 728 } |
728 | 729 |
729 DEFUN("fc-config-get-blanks", Ffc_config_get_blanks, 1, 1, 0, /* | 730 DEFUN("fc-config-get-blanks", Ffc_config_get_blanks, 1, 1, 0, /* |
733 this function will return 0. | 734 this function will return 0. |
734 XEmacs: should convert to a chartable. | 735 XEmacs: should convert to a chartable. |
735 #### Unimplemented. */ | 736 #### Unimplemented. */ |
736 (config)) | 737 (config)) |
737 { | 738 { |
738 CHECK_FCCONFIG (config); | 739 CHECK_FC_CONFIG (config); |
739 signal_error (Qunimplemented, "no method to convert FcBlanks object", | 740 signal_error (Qunimplemented, "no method to convert FcBlanks object", |
740 intern ("fc-config-get-blanks")); | 741 intern ("fc-config-get-blanks")); |
741 } | 742 } |
742 | 743 |
743 DEFUN("fc-config-get-rescan-interval", Ffc_config_get_rescan_interval, 1, 1, 0, /* | 744 DEFUN("fc-config-get-rescan-interval", Ffc_config_get_rescan_interval, 1, 1, 0, /* |
746 (in seconds) specified in 'config'. The configuration is checked | 747 (in seconds) specified in 'config'. The configuration is checked |
747 during a call to FcFontList when this interval has passed since | 748 during a call to FcFontList when this interval has passed since |
748 the last check. */ | 749 the last check. */ |
749 (config)) | 750 (config)) |
750 { | 751 { |
751 CHECK_FCCONFIG (config); | 752 CHECK_FC_CONFIG (config); |
752 return make_int (FcConfigGetRescanInterval (XFCCONFIG_PTR (config))); | 753 return make_int (FcConfigGetRescanInterval (XFC_CONFIG_PTR (config))); |
753 } | 754 } |
754 | 755 |
755 DEFUN("fc-config-set-rescan-interval", Ffc_config_set_rescan_interval, 2, 2, 0, /* | 756 DEFUN("fc-config-set-rescan-interval", Ffc_config_set_rescan_interval, 2, 2, 0, /* |
756 -- Function: FcBool FcConfigSetRescanInterval (FcConfig *config, int | 757 -- Function: FcBool FcConfigSetRescanInterval (FcConfig *config, int |
757 rescanInterval) | 758 rescanInterval) |
758 Sets the rescan interval; returns FcFalse if an error occurred. | 759 Sets the rescan interval; returns FcFalse if an error occurred. |
759 XEmacs: signal such error, or return nil on success. */ | 760 XEmacs: signal such error, or return nil on success. */ |
760 (config, rescan_interval)) | 761 (config, rescan_interval)) |
761 { | 762 { |
762 CHECK_FCCONFIG (config); | 763 CHECK_FC_CONFIG (config); |
763 CHECK_INT (rescan_interval); | 764 CHECK_INT (rescan_interval); |
764 if (FcConfigSetRescanInterval (XFCCONFIG_PTR (config), | 765 if (FcConfigSetRescanInterval (XFC_CONFIG_PTR (config), |
765 XINT (rescan_interval)) == FcFalse) | 766 XINT (rescan_interval)) == FcFalse) |
766 signal_error (Qio_error, "FcConfigSetRescanInverval barfed", | 767 signal_error (Qio_error, "FcConfigSetRescanInverval barfed", |
767 intern ("fc-config-set-rescan-interval")); | 768 intern ("fc-config-set-rescan-interval")); |
768 return Qnil; | 769 return Qnil; |
769 } | 770 } |
773 -- Function: FcBool FcConfigAppFontAddFile (FcConfig *config, const | 774 -- Function: FcBool FcConfigAppFontAddFile (FcConfig *config, const |
774 char *file) | 775 char *file) |
775 Adds an application-specific font to the configuration. */ | 776 Adds an application-specific font to the configuration. */ |
776 (config, file)) | 777 (config, file)) |
777 { | 778 { |
778 CHECK_FCCONFIG (config); | 779 CHECK_FC_CONFIG (config); |
779 CHECK_STRING (file); | 780 CHECK_STRING (file); |
780 if (FcConfigAppFontAddFile | 781 if (FcConfigAppFontAddFile |
781 (XFCCONFIG_PTR (config), | 782 (XFC_CONFIG_PTR (config), |
782 /* #### FIXME! is Qfile_name right? */ | 783 /* #### FIXME! is Qfile_name right? */ |
783 (FcChar8 *) LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) | 784 (FcChar8 *) LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) |
784 return Qnil; | 785 return Qnil; |
785 else | 786 else |
786 return Qt; | 787 return Qt; |
792 char *dir) | 793 char *dir) |
793 Scans the specified directory for fonts, adding each one found to | 794 Scans the specified directory for fonts, adding each one found to |
794 the application-specific set of fonts. */ | 795 the application-specific set of fonts. */ |
795 (config, dir)) | 796 (config, dir)) |
796 { | 797 { |
797 CHECK_FCCONFIG (config); | 798 CHECK_FC_CONFIG (config); |
798 CHECK_STRING (dir); | 799 CHECK_STRING (dir); |
799 if (FcConfigAppFontAddDir | 800 if (FcConfigAppFontAddDir |
800 (XFCCONFIG_PTR (config), | 801 (XFC_CONFIG_PTR (config), |
801 /* #### FIXME! is Qfile_name right? */ | 802 /* #### FIXME! is Qfile_name right? */ |
802 (FcChar8 *) LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) | 803 (FcChar8 *) LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) |
803 return Qnil; | 804 return Qnil; |
804 else | 805 else |
805 return Qt; | 806 return Qt; |
809 DEFUN("fc-config-app-font-clear", Ffc_config_app_font_clear, 1, 1, 0, /* | 810 DEFUN("fc-config-app-font-clear", Ffc_config_app_font_clear, 1, 1, 0, /* |
810 -- Function: void FcConfigAppFontClear (FcConfig *config) | 811 -- Function: void FcConfigAppFontClear (FcConfig *config) |
811 Clears the set of application-specific fonts. */ | 812 Clears the set of application-specific fonts. */ |
812 (config)) | 813 (config)) |
813 { | 814 { |
814 CHECK_FCCONFIG (config); | 815 CHECK_FC_CONFIG (config); |
815 FcConfigAppFontClear (XFCCONFIG_PTR (config)); | 816 FcConfigAppFontClear (XFC_CONFIG_PTR (config)); |
816 return Qnil; | 817 return Qnil; |
817 } | 818 } |
818 | 819 |
819 /* These functions provide some control over how the default | 820 /* These functions provide some control over how the default |
820 configuration of the library is initialized. (This configuration is | 821 configuration of the library is initialized. (This configuration is |
882 * Patterns without a specified style or slant are set to Roman | 883 * Patterns without a specified style or slant are set to Roman |
883 * Patterns without a specified pixel size are given one computed from any | 884 * Patterns without a specified pixel size are given one computed from any |
884 specified point size (default 12), dpi (default 75) and scale (default 1). */ | 885 specified point size (default 12), dpi (default 75) and scale (default 1). */ |
885 (pattern)) | 886 (pattern)) |
886 { | 887 { |
887 CHECK_FCPATTERN (pattern); | 888 CHECK_FC_PATTERN (pattern); |
888 FcDefaultSubstitute (XFCPATTERN_PTR (pattern)); | 889 FcDefaultSubstitute (XFC_PATTERN_PTR (pattern)); |
889 return Qnil; | 890 return Qnil; |
890 } | 891 } |
891 | 892 |
892 /* -- Function: FcBool FcConfigSubstituteWithPat (FcConfig *config, | 893 /* -- Function: FcBool FcConfigSubstituteWithPat (FcConfig *config, |
893 FcPattern *p, FcPattern *p_pat FcMatchKind kind) | 894 FcPattern *p, FcPattern *p_pat FcMatchKind kind) |
917 knd = FcMatchPattern; | 918 knd = FcMatchPattern; |
918 else | 919 else |
919 wtaerror ("need `fc-match-pattern' or `fc-match-font'", kind); | 920 wtaerror ("need `fc-match-pattern' or `fc-match-font'", kind); |
920 | 921 |
921 /* Typecheck arguments */ | 922 /* Typecheck arguments */ |
922 CHECK_FCPATTERN (pattern); | 923 CHECK_FC_PATTERN (pattern); |
923 if (!NILP (testpat)) CHECK_FCPATTERN (testpat); | 924 if (!NILP (testpat)) CHECK_FC_PATTERN (testpat); |
924 if (!NILP (config)) CHECK_FCCONFIG (config); | 925 if (!NILP (config)) CHECK_FC_CONFIG (config); |
925 | 926 |
926 return (FcConfigSubstituteWithPat | 927 return (FcConfigSubstituteWithPat |
927 (NILP (config) ? FcConfigGetCurrent () : XFCCONFIG_PTR (config), | 928 (NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config), |
928 XFCPATTERN_PTR (pattern), | 929 XFC_PATTERN_PTR (pattern), |
929 NILP (testpat) ? NULL : XFCPATTERN_PTR (testpat), | 930 NILP (testpat) ? NULL : XFC_PATTERN_PTR (testpat), |
930 knd) == FcTrue) | 931 knd) == FcTrue) |
931 ? Qt : Qnil; | 932 ? Qt : Qnil; |
932 } | 933 } |
933 | 934 |
934 /* Pattern matching functions. */ | 935 /* Pattern matching functions. */ |
951 (pattern, font, config)) | 952 (pattern, font, config)) |
952 { | 953 { |
953 if (NILP (config)) { | 954 if (NILP (config)) { |
954 config = Ffc_config_get_current (); | 955 config = Ffc_config_get_current (); |
955 } | 956 } |
956 CHECK_FCPATTERN (pattern); | 957 CHECK_FC_PATTERN (pattern); |
957 CHECK_FCPATTERN (font); | 958 CHECK_FC_PATTERN (font); |
958 CHECK_FCCONFIG (config); | 959 CHECK_FC_CONFIG (config); |
959 | 960 |
960 /* I don't think this can fail? */ | 961 /* I don't think this can fail? */ |
961 return wrap_fcpattern (FcFontRenderPrepare (XFCCONFIG_PTR(config), | 962 return wrap_fc_pattern (FcFontRenderPrepare (XFC_CONFIG_PTR(config), |
962 XFCPATTERN_PTR(font), | 963 XFC_PATTERN_PTR(font), |
963 XFCPATTERN_PTR(pattern))); | 964 XFC_PATTERN_PTR(pattern))); |
964 } | 965 } |
965 | 966 |
966 DEFUN("fc-font-match", Ffc_font_match, 2, 3, 0, /* | 967 DEFUN("fc-font-match", Ffc_font_match, 2, 3, 0, /* |
967 Return the font on DEVICE that most closely matches PATTERN. | 968 Return the font on DEVICE that most closely matches PATTERN. |
968 | 969 |
979 FcResult res; | 980 FcResult res; |
980 struct fc_pattern *res_fcpat; | 981 struct fc_pattern *res_fcpat; |
981 FcPattern *p; | 982 FcPattern *p; |
982 FcConfig *fcc; | 983 FcConfig *fcc; |
983 | 984 |
984 CHECK_FCPATTERN(pattern); | 985 CHECK_FC_PATTERN(pattern); |
985 if (NILP(device)) | 986 if (NILP(device)) |
986 return Qnil; | 987 return Qnil; |
987 CHECK_X_DEVICE(device); | 988 CHECK_X_DEVICE(device); |
988 if (!DEVICE_LIVE_P(XDEVICE(device))) | 989 if (!DEVICE_LIVE_P(XDEVICE(device))) |
989 return Qnil; | 990 return Qnil; |
990 if (!NILP (config)) | 991 if (!NILP (config)) |
991 CHECK_FCCONFIG (config); | 992 CHECK_FC_CONFIG (config); |
992 | 993 |
993 res_fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); | 994 res_fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
994 p = XFCPATTERN_PTR(pattern); | 995 p = XFC_PATTERN_PTR(pattern); |
995 fcc = NILP (config) ? FcConfigGetCurrent () : XFCCONFIG_PTR (config); | 996 fcc = NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config); |
996 | 997 |
997 FcConfigSubstitute (fcc, p, FcMatchPattern); | 998 FcConfigSubstitute (fcc, p, FcMatchPattern); |
998 FcDefaultSubstitute (p); | 999 FcDefaultSubstitute (p); |
999 res = FcResultMatch; | 1000 res = FcResultMatch; |
1000 res_fcpat->fcpatPtr = FcFontMatch (fcc, p, &res); | 1001 res_fcpat->fcpatPtr = FcFontMatch (fcc, p, &res); |
1007 return Qfc_result_no_id; | 1008 return Qfc_result_no_id; |
1008 default: | 1009 default: |
1009 return Qfc_internal_error; | 1010 return Qfc_internal_error; |
1010 } | 1011 } |
1011 else | 1012 else |
1012 return wrap_fcpattern(res_fcpat); | 1013 return wrap_fc_pattern(res_fcpat); |
1013 } | 1014 } |
1014 | 1015 |
1015 /* #### fix this name to correspond to Ben's new nomenclature */ | 1016 /* #### fix this name to correspond to Ben's new nomenclature */ |
1016 DEFUN("fc-list-fonts-pattern-objects", Ffc_list_fonts_pattern_objects, | 1017 DEFUN("fc-list-fonts-pattern-objects", Ffc_list_fonts_pattern_objects, |
1017 3, 3, 0, /* | 1018 3, 3, 0, /* |
1027 (UNUSED (device), pattern, properties)) | 1028 (UNUSED (device), pattern, properties)) |
1028 { | 1029 { |
1029 FcObjectSet *os; | 1030 FcObjectSet *os; |
1030 FcFontSet *fontset; | 1031 FcFontSet *fontset; |
1031 | 1032 |
1032 CHECK_FCPATTERN (pattern); | 1033 CHECK_FC_PATTERN (pattern); |
1033 CHECK_LIST (properties); | 1034 CHECK_LIST (properties); |
1034 | 1035 |
1035 os = FcObjectSetCreate (); | 1036 os = FcObjectSetCreate (); |
1036 string_list_to_fcobjectset (properties, os); | 1037 string_list_to_fcobjectset (properties, os); |
1037 /* #### why don't we need to do the "usual substitutions"? */ | 1038 /* #### why don't we need to do the "usual substitutions"? */ |
1038 fontset = FcFontList (NULL, XFCPATTERN_PTR (pattern), os); | 1039 fontset = FcFontList (NULL, XFC_PATTERN_PTR (pattern), os); |
1039 FcObjectSetDestroy (os); | 1040 FcObjectSetDestroy (os); |
1040 | 1041 |
1041 return fontset_to_list (fontset, DestroyYes); | 1042 return fontset_to_list (fontset, DestroyYes); |
1042 | 1043 |
1043 } | 1044 } |
1059 | 1060 |
1060 #### DEVICE is unused, ignored, and may be removed if it's not needed to | 1061 #### DEVICE is unused, ignored, and may be removed if it's not needed to |
1061 match other font-listing APIs. */ | 1062 match other font-listing APIs. */ |
1062 (UNUSED (device), pattern, trim, nosub)) | 1063 (UNUSED (device), pattern, trim, nosub)) |
1063 { | 1064 { |
1064 CHECK_FCPATTERN (pattern); | 1065 CHECK_FC_PATTERN (pattern); |
1065 | 1066 |
1066 { | 1067 { |
1067 FcConfig *fcc = FcConfigGetCurrent(); | 1068 FcConfig *fcc = FcConfigGetCurrent(); |
1068 FcFontSet *fontset; | 1069 FcFontSet *fontset; |
1069 FcPattern *p = XFCPATTERN_PTR (pattern); | 1070 FcPattern *p = XFC_PATTERN_PTR (pattern); |
1070 FcResult fcresult; | 1071 FcResult fcresult; |
1071 | 1072 |
1072 if (NILP(nosub)) /* #### temporary debug hack */ | 1073 if (NILP(nosub)) /* #### temporary debug hack */ |
1073 FcDefaultSubstitute (p); | 1074 FcDefaultSubstitute (p); |
1074 FcConfigSubstitute (fcc, p, FcMatchPattern); | 1075 FcConfigSubstitute (fcc, p, FcMatchPattern); |
1090 There is a default configuration which applications may use by passing | 1091 There is a default configuration which applications may use by passing |
1091 0 to any function using the data within an FcConfig. | 1092 0 to any function using the data within an FcConfig. |
1092 */ | 1093 */ |
1093 | 1094 |
1094 static void | 1095 static void |
1095 finalize_fc_config (void *header) | 1096 finalize_fc_config (Lisp_Object obj) |
1096 { | 1097 { |
1097 struct fc_config *p = (struct fc_config *) header; | 1098 struct fc_config *p = XFC_CONFIG (obj); |
1098 if (p->fccfgPtr && p->fccfgPtr != FcConfigGetCurrent()) | 1099 if (p->fccfgPtr && p->fccfgPtr != FcConfigGetCurrent()) |
1099 { | 1100 { |
1100 /* If we get here, all of *our* references are garbage (see comment on | 1101 /* If we get here, all of *our* references are garbage (see comment on |
1101 fc_config_create_using() for why), and the only reference that | 1102 fc_config_create_using() for why), and the only reference that |
1102 fontconfig keeps is the current FcConfig. */ | 1103 fontconfig keeps is the current FcConfig. */ |
1107 | 1108 |
1108 static void | 1109 static void |
1109 print_fc_config (Lisp_Object obj, Lisp_Object printcharfun, | 1110 print_fc_config (Lisp_Object obj, Lisp_Object printcharfun, |
1110 int UNUSED(escapeflag)) | 1111 int UNUSED(escapeflag)) |
1111 { | 1112 { |
1112 struct fc_config *c = XFCCONFIG (obj); | 1113 struct fc_config *c = XFC_CONFIG (obj); |
1113 if (print_readably) | 1114 if (print_readably) |
1114 printing_unreadable_object ("#<fc-config 0x%x>", c->header.uid); | 1115 printing_unreadable_object ("#<fc-config 0x%x>", c->header.uid); |
1115 write_fmt_string (printcharfun, "#<fc-config 0x%x>", c->header.uid); | 1116 write_fmt_string (printcharfun, "#<fc-config 0x%x>", c->header.uid); |
1116 } | 1117 } |
1117 | 1118 |