From: handa Date: Thu, 18 Mar 2010 08:15:43 +0000 (+0000) Subject: merge trunk X-Git-Tag: XML-after-trunk-merge X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=ba3c209c2c7d0a34fbda664a03174c0498fc6f3a;p=m17n%2Fm17n-lib.git merge trunk --- diff --git a/ChangeLog b/ChangeLog index 9390f7c..bf65e3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,49 @@ +2010-02-18 Kenichi Handa + + * configure.ac (M17N_BINARY_VERSION): New variable. + (M17N_MODULE_DIR): New variable. AC_SUBST it. + +2009-11-05 Kenichi Handa + + * configure.ac: Check if the OTF library has OTF_drive_gpos2 (). + +2009-10-05 Kenichi Handa + + * configure.ac: Version changed to 1.6.0. + (API_VERSION): Changed to 4.0.4. + +2009-08-13 Kenichi Handa + + * Version 1.5.5 released. + +2009-07-29 Kenichi Handa + + * configure.ac: Add AC_CONFIG_MACRO_DIR([m4]). Update by + autoupdate program. + + * mkinstalldirs: Removed. + + * bootstrap.sh: Simplified by using autoreconf. + +2009-07-28 Kenichi Handa + + * configure.ac: Version changed to 1.5.5. + +2009-03-02 Kenichi Handa + + * Version 1.5.4 released. + +2009-02-25 Kenichi Handa + + * configure.ac: Version changed to 1.5.4. + 2008-10-20 Kenichi Handa * Version 1.5.3 released. 2008-09-24 Kenichi Handa - * configure.ac: Versions changes to 1.5.3. + * configure.ac: Versions changed to 1.5.3. 2008-06-23 Kenichi Handa @@ -350,7 +389,7 @@ * Version 1.0 released. -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 diff --git a/NEWS b/NEWS index 9ae6652..575c0ca 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,22 @@ * NEWS -- What's new in the m17n library. -*- outline -*- -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 See the end for copying conditions. +* Changes in the m17n library 1.5.5 + +** Now libtool 2.2.4 or the later is required to build the library +from CVS source. + + +* Changes in the m17n library 1.5.4 + +** New coding system names "Shift_JIS" and "windows-XXXX" are +recognized. + + * Changes in the m17n library 1.5.3 This release is just for bug fixing. @@ -182,7 +194,7 @@ library and the GD library. * Copyright information -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 diff --git a/README b/README index da9a6d1..83980e2 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ -This directory tree holds version 1.5.3 of the m17n library. -*- text -*- +This directory tree holds version 1.5.5 of the m17n library. -*- text -*- -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 See the end for copying conditions. @@ -13,12 +13,15 @@ language. (1-1) From CVS working directory. -Run the script "bootstrap.sh" in this directory. It is tested that -the script run successfully with these versions of autotools. +Run the program "autoreconf" as below in this directory. + % autoreconf -f -i - libtool-1.5.22 +It is tested that the script run successfully with these versions of +autotools. + libtool-2.2.4 automake-1.9.6 autoconf-2.61 + pkg-config-0.22 Then, proceed to the next step. @@ -64,9 +67,11 @@ These library files are installed in /usr/local/lib: libm17n-core.{a,so*,la} libm17n.{a,so*,la} libm17n-gui.{a,so*,la} + libm17n-flt.{a,so*,la} + +These modules are installed in /usr/local/lib/m17n/1.0: libm17n-X.{a,so*,la} libm17n-gd.{a,so*,la} - libm17n-flt.{a,so*,la} libimx-anthy.{a,so*,la}, libimx-ispell.{a,so*,la}, @@ -145,7 +150,7 @@ This compiles PROX.c that uses GUI API and builds executable PROX. ---------------------------------------------------------------------- Copyright information -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 diff --git a/bootstrap.sh b/bootstrap.sh index 5ad2904..bbc2cb8 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,28 +1,6 @@ #!/bin/sh # bootstrap.sh -- shell script to build the m17n library from CVS. -# Copyright (C) 2003, 2004, 2005, 2006 -# National Institute of Advanced Industrial Science and Technology (AIST) -# Registration Number H15PRO112 -# See the end for copying conditions. - -echo "Cleaning up old files..." -rm -rf INSTALL aclocal.m4 autom4te.cache config.guess. config.sub install-sh ltmain.sh missing libtool -echo "Running aclocal..." -aclocal -I m4 -echo "Running autoheader..." -autoheader -echo "Running libtoolize..." -libtoolize --automake -echo "Running automake..." -automake -a -c -echo "Running autoconf..." -autoconf -echo "The remaining steps to install this library are:" -echo " % ./configure" -echo " % make" -echo " % make install" - -# Copyright (C) 2003, 2004 +# Copyright (C) 2003, 2004, 2005, 2006, 2009 # National Institute of Advanced Industrial Science and Technology (AIST) # Registration Number H15PRO112 @@ -42,3 +20,10 @@ echo " % make install" # License along with the m17n library; if not, write to the Free # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. + +echo "Running autoreconf -v -f -i" +autoreconf -v -f -i +echo "The remaining steps to install this library are:" +echo " % ./configure" +echo " % make" +echo " % make install" diff --git a/configure.ac b/configure.ac index 7bf5fd0..c45b94f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl configure.ac -- autoconf script for the m17n library. -dnl Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +dnl Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 dnl National Institute of Advanced Industrial Science and Technology (AIST) dnl Registration Number H15PRO112 @@ -23,23 +23,30 @@ dnl Boston, MA 02110-1301, USA. dnl Process this file with autoconf to produce a configure script. -AC_INIT(m17n-lib, 1.5.3, m17n-lib-bug@m17n.org) +AC_INIT([m17n-lib],[1.6.0],[m17n-lib-bug@m17n.org]) +AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE -AM_CONFIG_HEADER(src/config.h) +AC_CONFIG_HEADERS([src/config.h]) AM_MAINTAINER_MODE -API_VERSION=3:0:3 +API_VERSION=4:0:4 AC_SUBST(API_VERSION) +# The earliest version that this release has binary compatibility +# with. This is used for module locations. +M17N_BINARY_VERSION=1.0 + +M17N_MODULE_DIR="m17n/$M17N_BINARY_VERSION" +AC_SUBST(M17N_MODULE_DIR) + AM_GNU_GETTEXT GETTEXTDIR="$datadir/locale" AC_SUBST(GETTEXTDIR) dnl Checks for programs for compiling. AC_PROG_CC -AC_LIBTOOL_DLOPEN -AC_LIBLTDL_CONVENIENCE -AM_PROG_LIBTOOL +LT_PREREQ([2.2.4]) +LT_INIT dnl Checks for X libraries. AC_PATH_XTRA @@ -86,8 +93,7 @@ AC_SUBST(M17NDIR) dnl Checks which levels of APIs should be compiled. AC_ARG_ENABLE(gui, - AC_HELP_STRING([--with-gui], - [with GUI level APIs (default is YES)])) + AS_HELP_STRING([--with-gui],[with GUI level APIs (default is YES)])) AM_CONDITIONAL(WITH_GUI, test x$with_gui != xno) @@ -151,8 +157,7 @@ AC_SUBST(FRIBIDI_LD_FLAGS) dnl Check for otflib usability. AC_ARG_WITH(libotf, - AC_HELP_STRING([--with-libotf], - [with OpenType font suport (default is YES)])) + AS_HELP_STRING([--with-libotf],[with OpenType font suport (default is YES)])) if test "x$with_libotf" != "xno"; then save_CPPFLAGS="$CPPFLAGS" @@ -173,6 +178,12 @@ if test "x$with_libotf" != "xno"; then AC_DEFINE(HAVE_OTF, 1, [Define to 1 if you have OTF library and header file.]) M17N_EXT_LIBS="$M17N_EXT_LIBS libotf" + AC_CHECK_LIB(otf, OTF_drive_gpos2, HAVE_OTF_DRIVE_GPOS2=yes, + HAVE_OTF_DRIVE_GPOS2=no) + if test "x$HAVE_OTF_DRIVE_GPOS2" = "xyes"; then + AC_DEFINE(HAVE_OTF_DRIVE_GPOS2, 1, + [Define to 1 if the OTF library has OTF_drive_gpos2().]) + fi else CPPFLAGS="$save_CPPFLAGS" OTF_LD_FLAGS= @@ -248,8 +259,7 @@ AC_SUBST(XFT2_LD_FLAGS) dnl Check for fontconfig usability. AC_ARG_WITH(fontconfig, - AC_HELP_STRING([--with-fontconfig], - [with FontConfig library (default is YES)])) + AS_HELP_STRING([--with-fontconfig],[with FontConfig library (default is YES)])) if test "x$with_fontconfig" != "xno"; then save_CPPFLAGS="$CPPFLAGS" save_LIBS="$LIBS" @@ -277,8 +287,7 @@ AC_SUBST(FONTCONFIG_LD_FLAGS) dnl Check for gdlib usability. AC_ARG_WITH(gd, - AC_HELP_STRING([--with-gd], - [suport graphic device by GD library (default is YES)])) + AS_HELP_STRING([--with-gd],[suport graphic device by GD library (default is YES)])) if test "x$with_gd" != "xno"; then save_LIBS="$LIBS" @@ -362,12 +371,12 @@ elif test "x$HAVE_WORDCUT" = "xyes"; then save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $WORDCUT_CFLAGS" - AC_TRY_CPP([#include ], , HAVE_WORDCUT=no) + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])],[],[HAVE_WORDCUT=no]) if test "x$HAVE_WORDCUT" = "xno"; then PKG_CHECK_MODULES(GLIB_2_0, glib-2.0, HAVE_GLIB_2_0=yes, HAVE_GLIB_2_0=no) if test "x$HAVE_GLIB_2_0" = "xyes"; then CPPFLAGS="$CPPFLAGS $GLIB_2_0_CFLAGS" - AC_TRY_CPP([#include ], HAVE_WORDCUT=yes) + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])],[HAVE_WORDCUT=yes],[]) fi fi if test "x$HAVE_WORDCUT" = "xyes"; then diff --git a/example/ChangeLog b/example/ChangeLog index 9e8f408..1ed64f2 100644 --- a/example/ChangeLog +++ b/example/ChangeLog @@ -1,3 +1,36 @@ +2010-02-18 Kenichi Handa + + * Makefile.am: Build modules dynamically loaded with + -avoid-version and no -version-info. + +2010-02-09 Kenichi Handa + + * HELLO.utf8 (Greek, Hindi): Fixed. + +2009-08-13 Kenichi Handa + + * Version 1.5.5 released. + +2009-03-02 Kenichi Handa + + * Version 1.5.4 released. + +2009-01-15 Kenichi Handa + + * mconv.c (suppress_warning, continue_on_error): Make them global + variables. + (check_invalid_bytes, check_unencoded_chars): Check + suppress_warning and continue_on_error. + (unknown_encoding): New function. + (FATAL_ERROR): Check suppress_warning. + (main): Use unknown_encoding. Call check_invalid_bytes and + check_unencoded_chars unconditionally. + +2008-12-26 Kenichi Handa + + * mconv.c (main): Print a proper error message if the specified + encoding requires m17n-db. + 2008-10-30 Andreas Schwab (tiny change) * medit.c (FilterProc): Fix strict aliasing bug. @@ -710,7 +743,7 @@ * Version 1.0 released. -Copyright (C) 2003, 2004 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 diff --git a/example/HELLO.utf8 b/example/HELLO.utf8 index 498e294..22b80a7 100644 --- a/example/HELLO.utf8 +++ b/example/HELLO.utf8 @@ -4,7 +4,7 @@ Europe German (Deutsch) Guten Tag, Grüß Gott Slovak (slovensky) Dobrý deň Russian (русский) Здравствуйте! - Greek (ἑλληνικά) Γειά σας + Greek (ελληνικά) Γειά σας Armenian (հայերեն) Բարեւ։ Georgian (ქართული) გამარჯობათ! @@ -17,7 +17,7 @@ Middle Near East/Africa Amharic (አማርኛ) ሠላም South/South-East Asia - Hindi (हिन्दी) नमस्ते, नमस्कार । + Hindi (हिंदी) नमस्ते, नमस्कार । Bengali (বাংলা) নমস্কার Punjabi (ਪੰਜਾਬੀ) ਸਤਿ ਸ਼੍ਰੀ ਅਕਾਲ Gujarati (ગુજરાતી) નમસ્તે diff --git a/example/Makefile.am b/example/Makefile.am index baceac3..5266569 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -63,7 +63,7 @@ EXTRA_DIST = \ # External modules used by the above input methods. -VINFO = -version-info @API_VERSION@ +moduledir = ${libdir}/@M17N_MODULE_DIR@ BASICBUILDS = libmimx-anthy.la if WITH_GUI @@ -71,14 +71,14 @@ BUILD_LIBS = $(BASICBUILDS) libmimx-ispell.la else BUILD_LIBS = $(BASICBUILDS) endif -lib_LTLIBRARIES = $(BUILD_LIBS) +module_LTLIBRARIES = $(BUILD_LIBS) libmimx_ispell_la_SOURCES = mimx-ispell.c libmimx_ispell_la_LIBADD = ${common_ldflags_gui} -libmimx_ispell_la_LDFLAGS = -module ${VINFO} +libmimx_ispell_la_LDFLAGS = -avoid-version -module libmimx_anthy_la_SOURCES = mimx-anthy.c libmimx_anthy_la_LIBADD = ${common_ldflags} @ANTHY_LD_FLAGS@ -libmimx_anthy_la_LDFLAGS = -module ${VINFO} +libmimx_anthy_la_LDFLAGS = -avoid-version -module if MAINTAINER_MODE diff --git a/example/mconv.c b/example/mconv.c index f31e5a6..09a4969 100644 --- a/example/mconv.c +++ b/example/mconv.c @@ -1,5 +1,5 @@ /* mconv.c -- Code converter. -*- coding: euc-jp; -*- - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -203,6 +203,9 @@ help_exit (char *prog, int exit_code) exit (exit_code); } +/* Global flags to control the behaviour. */ +int suppress_warning; +int continue_on_error; /* Check invalid bytes found in the last decoding. Text property Mcharset of such a byte is Mcharset_binary. */ @@ -222,14 +225,24 @@ check_invalid_bytes (MText *mt) if (charset == Mcharset_binary) { - if (first) + if (! suppress_warning) { - fprintf (stderr, - "Invalid bytes (at each character position);\n"); - first = 0; + if (first) + { + fprintf (stderr, + "Invalid bytes (at each character position);\n"); + first = 0; + } + for (; from < to; from++) + fprintf (stderr, " 0x%02X(%d)", + mtext_ref_char (mt, from), from); + } + if (! continue_on_error) + { + if (! first) + fprintf (stderr, "\n"); + exit (1); } - for (; from < to; from++) - fprintf (stderr, " 0x%02X(%d)", mtext_ref_char (mt, from), from); } else from = to; @@ -256,14 +269,24 @@ check_unencoded_chars (MText *mt, int len) if (coding == Mnil) { - if (first) + if (! suppress_warning) + { + if (first) + { + fprintf (stderr, + "Unencoded chars (at each character position):\n"); + first = 0; + } + for (; from < to; from++) + fprintf (stderr, " 0x%02X(%d)", + mtext_ref_char (mt, from), from); + } + if (! continue_on_error) { - fprintf (stderr, - "Unencoded characters (at each character position):\n"); - first = 0; + if (! first) + fprintf (stderr, "\n"); + exit (1); } - for (; from < to; from++) - fprintf (stderr, " 0x%02X(%d)", mtext_ref_char (mt, from), from); } else from = to; @@ -273,19 +296,32 @@ check_unencoded_chars (MText *mt, int len) } +void +unknown_encoding (char *name) +{ + if (! suppress_warning) + { + fprintf (stderr, "Unknown encoding: \"%s\"\n", name); + if (mconv_resolve_coding (msymbol ("iso-2022-jp")) == Mnil) + fprintf (stderr, "Perhaps the library \"m17n-db\" is missing.\n"); + } + exit (1); +} + /* Format MSG by FMT and print the result to the stderr, and exit. */ -#define FATAL_ERROR(fmt, arg) \ - do { \ - fprintf (stderr, fmt, arg); \ - exit (1); \ +#define FATAL_ERROR(fmt, arg) \ + do { \ + if (! suppress_warning) \ + fprintf (stderr, fmt, arg); \ + exit (1); \ } while (0) int main (int argc, char **argv) { - int suppress_warning, verbose, continue_on_error; + int verbose; MSymbol incode, outcode; FILE *in, *out; MText *mt; @@ -313,7 +349,7 @@ main (int argc, char **argv) else if (! strcmp (argv[i], "--version")) { printf ("m17n-conv (m17n library) %s\n", M17NLIB_VERSION_NAME); - printf ("Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 AIST, JAPAN\n"); + printf ("Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 AIST, JAPAN\n"); exit (0); } else if (! strcmp (argv[i], "-l")) @@ -326,13 +362,13 @@ main (int argc, char **argv) { incode = mconv_resolve_coding (msymbol (argv[++i])); if (incode == Mnil) - FATAL_ERROR ("Unknown encoding: %s\n", argv[i]); + unknown_encoding (argv[i]); } else if (! strcmp (argv[i], "-t")) { outcode = mconv_resolve_coding (msymbol (argv[++i])); if (outcode == Mnil) - FATAL_ERROR ("Unknown encoding: %s\n", argv[i]); + unknown_encoding (argv[i]); } else if (! strcmp (argv[i], "-k")) continue_on_error = 1; @@ -360,12 +396,17 @@ main (int argc, char **argv) else help_exit (argv[0], 1); } + if (verbose) + suppress_warning = 0; /* Create an M-text to store the decoded characters. */ mt = mtext (); /* Create a converter for decoding. */ converter = mconv_stream_converter (incode, in); + if (! converter) + FATAL_ERROR ("Encoding \"%s\" requires the missing library \"m17n-db\".\n", + msymbol_name (incode)); /* Instead of doing strict decoding, we decode all input bytes at once, and check invalid bytes later by the fuction check_invalid_bytes. */ @@ -373,8 +414,7 @@ main (int argc, char **argv) mconv_decode (converter, mt); - if (! suppress_warning) - check_invalid_bytes (mt); + check_invalid_bytes (mt); if (verbose) fprintf (stderr, "%d bytes (%s) decoded into %d characters,\n", converter->nbytes, msymbol_name (incode), mtext_len (mt)); @@ -383,6 +423,9 @@ main (int argc, char **argv) /* Create a converter for encoding. */ converter = mconv_stream_converter (outcode, out); + if (! converter) + FATAL_ERROR ("Encoding \"%s\" requires the missing library \"m17n-db\".\n", + msymbol_name (outcode)); /* Instead of doing strict encoding, we encode all characters at once, and check unencoded characters later by the fuction check_unencoded_chars. */ @@ -391,8 +434,7 @@ main (int argc, char **argv) if (mconv_encode (converter, mt) < 0 && ! suppress_warning) fprintf (stderr, "I/O error on writing\n"); - if (! suppress_warning) - check_unencoded_chars (mt, converter->nchars); + check_unencoded_chars (mt, converter->nchars); if (verbose) fprintf (stderr, "%d characters encoded into %d bytes (%s).\n", converter->nchars, converter->nbytes, msymbol_name (outcode)); diff --git a/src/ChangeLog b/src/ChangeLog index 9aaacf5..e960f30 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,10 +6,287 @@ * input-xml.c (decode_saction): Add support for "shift-back". +2010-03-01 Kenichi Handa + + * m17n-flt.c (run_rule): Fix checking of glyph availability. + 2009-02-19 TAKAHASHI Naoto * input-xml.c: Added necessary M17N_OBJECT_UNREF here and there. +2010-02-18 Kenichi Handa + + * m17n-gui.c (register_device_library): Preprend M17N_MODULE_DIR + to the module file name. + + * input.c (load_external_module): Preprend M17N_MODULE_DIR to the + module file name. + + * charset.c (load_charset): Check the return value of fgets. + + * Makefile.am: Build modules dynamically loaded with + -avoid-version and no -version-info. + +2010-01-15 Kenichi Handa + + * draw.c (run_flt): Set mflt_try_otf to rfont->driver->try_otf. + (mdraw__init): Set mflt_enable_new_feature to 1. + + * font-ft.c (ft_try_otf): New function. + (mfont__ft_driver): Set ft_try_otf. + + * font.h (struct MFontDriver): New member try_otf. + + * m17n-X.c (xft_driver): Set xft_try_otf. + (xft_try_otf): New function. + + * m17n-flt.h: (mflt_enable_new_feature): Extern it. + (mflt_try_otf): Extern it. + + * m17n-flt.c (load_category_table): If mflt_enable_new_feature is + zero, return NULL for such categories that require the new + feature. + (parse_otf_command): If mflt_enable_new_feature is zero, return + -1. + (load_otf_command): Fix previous change. + (load_flt): Check the return value of load_category_table. + (try_otf): Renamed from run_otf_category. Call mflt_try_otf + instead of font->drive_otf. + (run_command): Call try_otf instead of run_otf_category. + (m17n_init_flt): Initialize mflt_enable_new_feature to 0, + mflt_try_otf to NULL. + (mflt_enable_new_feature): New variable. + (mflt_try_otf): New variable. + +2009-12-10 Kenichi Handa + + * m17n-flt.c (parse_otf_command): Handle ":otf?". + (run_otf_category): If not features are specified, reset category + codes. + (run_command): On copy, don't re-calculate a category code. + +2009-12-03 Kenichi Handa + + * m17n-flt.c (run_stages): Reset category code if category-table + is changed. + (mflt_run): Don't set category code here. + (decode_packed_otf_tag): If no feature is applied, re-calculate + category code. + +2009-12-02 Kenichi Handa + + * m17n-flt.c (mflt_find): If FONT is specified but no flt is + found, return NULL. + (run_command): Don't set ENCODED and MEASURED of separator. + +2009-11-30 Kenichi Handa + + * m17n-flt.c (load_otf_command): Check 4th char against '?'. + (load_command): Likewise. + (decode_packed_otf_tag): New arg CTX. If CTX->in == gstring, + update CTX->encoded. Caller changed. + +2009-11-30 Kenichi Handa + + * font-ft.c (ft_drive_otf): Check if OUT is null or not. + (ft_drive_otf): Call OTF_drive_gsub_with_log and + OTF_drive_gpos_with_log. Record the applied feature in + g->g.internal. + + * font.c (mfont__get_glyph_id): Encode g->c instead of g->code. + + * internal-flt.h (MAKE_COMBINING_CODE_BY_CLASS) + (COMBINING_BY_CLASS_P, COMBINING_CODE_CLASS) + (MAKE_PRECOMPUTED_COMBINDING_CODE, COMBINING_PRECOMPUTED_P): + Delete externs.. + (PACK_OTF_TAG): Extern it. + + * draw.c (reorder_combining_chars): Delete it. + + * m17n-flt.h (mflt_font_id): Use type MFLFont. + (mflt_iterate_otf_feature): Likewise. + + * m17n-flt.c (enum GlyphInfoMask): New member CategoryCodeMask and + CombinedMask. + (GET_CATEGORY_CODE, SET_CATEGORY_CODE, GET_COMBINED): New macros. + (SET_COMBINING_CODE): Set also CombinedMask. + (FontLayoutFeatureTable): Delete it. + (FeatureCodeTable): New type. + (FontLayoutCategory): Type of feature_table changed. + (load_category_table): Adjusted for the change of + FontLayoutCategory. + (unref_category_table): Likewise. + (gen_otf_tag): New member shift. Caller changed. + (FontLayoutContext): New member category. + (run_rule): Compare g->c instead of g->code. + (decode_packed_otf_tag): New function. + (run_otf): Call decode_packed_otf_tag. Don't reset combining-code + here. + (run_otf_category): New function. + (run_command): Set category-code if necessary. Call + run_otf_category for FontLayoutCmdTypeOTFCategory. + (run_stages): Set ctx->category. Get category from glyph if + possible. + (mflt_dump_gstring): New function. + +2009-11-26 Kenichi Handa + + * m17n-flt.c (enum FontLayoutCmdType): New member + FontLayoutCmdTypeOTFCategory. + (FontLayoutFeatureTable): New type. + (FontLayoutCategory): New members feature_table_size and + feature_table. + (load_category_table): Handle feature_table. + (unref_category_table): Likewise. + (load_otf_command): Handle FontLayoutCmdTypeOTFCategory. + (load_command): Likewise. + (free_flt_command): Likewise. + +2009-11-10 Kenichi Handa + + * draw.c (run_flt): Update category code of each glyph. + +2009-11-07 Kenichi Handa + + * font-ft.c (ft_drive_otf): Don't accumulate anchor adjustments. + +2009-11-05 Kenichi Handa + + * m17n-flt.c (run_otf): Fix updating of g->lbearing, etc. + + * font-ft.c (ft_drive_otf): Use OTF_drive_gpos2 if possible. + +2009-10-28 Kenichi Handa + + * fontset.c (mdebug_flag): New variable. + (mfont__lookup_fontset): Print debug info. + + * m17n-core.c (m17n_init_core): Call SET_DEBUG_FLAG for + MDEBUG_FONTSET. + + * internal.h (enum MDebugFlag): Add MDEBUG_FONTSET. + + * language.c (mscript__from_otf_tag): Adjusted for the new format + of the database . + +2009-10-22 Kenichi Handa + + * database.c (check_version): Fix the check. + + * input.c (surrounding_pos): New arg *pos. + (integer_value): Fix handling of "@+0". + (take_action_list): Adjusted for the change of surrounding_pos. + +2009-10-05 Kenichi Handa + + * m17n-flt.h: (mflt_iterate_otf_feature, mflt_font_id): Extern + them. + + * m17n-flt.c (FontLayoutCategory): New typedef. + (FontLayoutStage): Type of the member `category' changed. + (struct _MFLT): Type of the member `coverage' changed. New member + need_config and font_id. + (apply_otf_feature): New function. + (load_category_table): New arg FONT. If FONT is non-NULL, call + apply_otf_feature. Setup category->definition. + (ref_category_table): New macro. + (unref_category_table): New function. + (load_flt): Adjusted for the type change of category. + (free_flt_stage): New arg FLT. + (list_flt): Adjusted for the type change of category. + (run_stages): Adjusted for the type change of category. + (configure_category, configure_flt): New function. + (m17n_init_flt): Initialize mflt_iterate_otf_feature and + mflt_font_id to NULL. + (mflt_get): Skip the heading configured FLTs. + (mflt_find): Likewise. If necessary, configure the found flt. + (mflt_run): Handle mflt_iterate_otf_feature and mflt_font_id. + Adjusted for the type change of category. + (mflt_iterate_otf_feature, mflt_font_id): New variable. + + * m17n-X.c (xfont_open): Set rfont->id. + (xft_driver): Set xft_iterate_otf_feature. + (xft_open): Set rfont->id. + (xft_iterate_otf_feature): New function. + + * font.h (struct MRealizedFont): New member id. + (struct MFontDriver): New member iterate_otf_feature. + + * font.c (mfont__get_glyph_id): Pay attention to. mfont->source. + + * font-ft.c (ft_open, ft_encapsulate): Set rfont->id. + (get_otf): New funcition. + (ft_check_otf, ft_drive_otf): Use get_otf. + (iterate_callback, ft_iterate_otf_feature): New functions. + (mfont__ft_driver): Set ft_iterate_otf_feature. + + * draw.c: Docstring updated. + (font_id): New function. + (run_flt): Set mflt_font_id and mflt_iterate_otf_feature before + calling mflt_run. + +2009-10-02 Kenichi Handa + + * m17n-flt.c (load_flt): Check the return value of + load_category_table. + +2009-09-03 Kenichi Handa + + * m17n-flt.c (run_otf): Clear combining code for glyphs whose + positions are adjusted by GPOS table. + +2009-08-13 Kenichi Handa + + * Version 1.5.5 released. + +2009-08-13 Kenichi Handa + + * m17n-core.h (M17NLIB_PATCH_LEVEL): Changed to 5. + (M17NLIB_VERSION_NAME): Changed to "1.5.5". + +2009-03-03 Kenichi Handa + + * draw.c (compose_glyph_string): Check if category not Mnil. + +2009-03-02 Kenichi Handa + + * Version 1.5.4 released. + +2009-02-25 Kenichi Handa + + * m17n-core.c (report_object_array): For M-text and Plist, print + more information. + + * m17n-core.h (M17NLIB_PATCH_LEVEL): Changed to 4. + (M17NLIB_VERSION_NAME): Changed to "1.5.4". + + * input.c (get_candidate_list): Free unnecessary objects. + (take_action_list): Free plist. + +2009-02-04 Kenichi Handa + + * coding.c (mcoding__init): Add "Shift_JIS" as an alias of "sjis". + +2009-01-16 Kenichi Handa + + * m17n-core.h (Mcased, Msoft_dotted, Mcase_mapping, Mblock): + Extern them. + + * character.c (Mcased, Msoft_dotted, Mcase_mapping, Mblock): New + variables. + +2009-01-14 Kenichi Handa + + * coding.c (decode_coding_iso_2022): Check invocation status + before updating charset0 and charset1. + + * symbol.c (msymbol__canonicalize): Handle "windows-XXXX". + +2008-12-31 Kenichi Handa + + * m17n-flt.c (mflt_run): If g->encoded is set, don't clear + g->code. + 2008-10-30 Andreas Schwab (tiny change) * face.c (mface_get_prop): Fix strict aliasing bug. @@ -4564,7 +4841,7 @@ * Version 1.0 released. -Copyright (C) 2003, 2004 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 diff --git a/src/Makefile.am b/src/Makefile.am index 5449f15..f97d68e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,7 +23,7 @@ VINFO = -version-info @API_VERSION@ BASICBUILDS = libm17n-core.la libm17n.la libm17n-flt.la if WITH_GUI -BUILD_LIBS = $(BASICBUILDS) libm17n-gui.la libm17n-X.la libm17n-gd.la +BUILD_LIBS = $(BASICBUILDS) libm17n-gui.la else BUILD_LIBS = $(BASICBUILDS) endif @@ -83,18 +83,23 @@ libm17n_gui_la_SOURCES = ${GUI_SOURCES} libm17n_gui_la_LIBADD = ${OPTIONAL_LD_FLAGS} ${top_builddir}/src/libm17n-core.la ${top_builddir}/src/libm17n.la ${top_builddir}/src/libm17n-flt.la libm17n_gui_la_LDFLAGS = -export-dynamic ${VINFO} +if WITH_GUI + +moduledir = ${libdir}/@M17N_MODULE_DIR@ +module_LTLIBRARIES = libm17n-X.la libm17n-gd.la X_LD_FLAGS = ${X_PRE_LIBS} ${X_LIBS} @X11_LD_FLAGS@ ${X_EXTRA_LIBS} libm17n_X_la_SOURCES = m17n-X.h m17n-X.c libm17n_X_la_LIBADD = ${X_LD_FLAGS} @XFT2_LD_FLAGS@ ${top_builddir}/src/libm17n-core.la ${top_builddir}/src/libm17n.la ${top_builddir}/src/libm17n-flt.la ${top_builddir}/src/libm17n-gui.la -libm17n_X_la_LDFLAGS = -module ${VINFO} +libm17n_X_la_LDFLAGS = -avoid-version -module libm17n_gd_la_SOURCES = m17n-gd.c libm17n_gd_la_LIBADD = @GD_LD_FLAGS@ @FREETYPE_LD_FLAGS@ ${top_builddir}/src/libm17n-core.la ${top_builddir}/src/libm17n.la ${top_builddir}/src/libm17n-flt.la ${top_builddir}/src/libm17n-gui.la -libm17n_gd_la_LDFLAGS = -module ${VINFO} +libm17n_gd_la_LDFLAGS = -avoid-version -module -AM_CPPFLAGS = -DM17NDIR=\"@M17NDIR@\" -DGETTEXTDIR=\"@GETTEXTDIR@\" +endif +AM_CPPFLAGS = -DM17NDIR=\"@M17NDIR@\" -DM17N_MODULE_DIR=\"${libdir}/@M17N_MODULE_DIR@\" -DGETTEXTDIR=\"@GETTEXTDIR@\" BASICHEADERS = m17n-core.h m17n.h m17n-misc.h m17n-flt.h if WITH_GUI diff --git a/src/character.c b/src/character.c index abc3c39..085287c 100644 --- a/src/character.c +++ b/src/character.c @@ -101,6 +101,10 @@ mchar__init () Mbidi_category = msymbol ("bidirectional-category"); Msimple_case_folding = msymbol ("simple-case-folding"); Mcomplicated_case_folding = msymbol ("complicated-case-folding"); + Mcased = msymbol ("cased"); + Msoft_dotted = msymbol ("soft-dotted"); + Mcase_mapping = msymbol ("case-mapping"); + Mblock = msymbol ("block"); Mscript = msymbol ("script"); return 0; @@ -200,6 +204,8 @@ mchar__define_prop (MSymbol key, MSymbol type, void *mdb) @name ÊÑ¿ô: ʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼ ¤³¤ì¤é¤Î¥·¥ó¥Ü¥ë¤Ïʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£*/ + +/*=*/ /*** @{ */ /***en @@ -346,6 +352,8 @@ MSymbol Mbidi_category; ¤È¤¤¤¦¥­¡¼¤Îʸ»ú¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£ */ MSymbol Msimple_case_folding; +/*=*/ + /***en @brief Key for corresponding multiple lowercase characters. @@ -367,6 +375,86 @@ MSymbol Msimple_case_folding; MSymbol Mcomplicated_case_folding; /*=*/ + +/***en + @brief Key for values used in case operation. + + The symbol #Mcased has the name "cased" and is used as + the key of charater property. The value of such a property is an + integer value 1, 2, or 3 representing "cased", "case-ignorable", + and both of them respective. See the Unicode Standard 5.0 + (Section 3.13 Default Case Algorithm) for the detail. + */ + +/***ja + @brief Case ½èÍý¤ËÍѤ¤¤é¤ì¤ëÃͤΥ­¡¼. + + ¥·¥ó¥Ü¥ë #Mcased ¤Ï¡¢"cased" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ + ¥Æ¥£¤Î¥­¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤÏÀ°¿ôÃÍ 1, 2, 3 ¤Î¤¤¤º + ¤ì¤«¤Ç¤¢¤ê¡¢¤½¤ì¤¾¤ì "cased", "case-ignorable", ¤½¤ÎξÊý¤ò°ÕÌ£¤¹¤ë¡£ + ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢the Unicode Standard 5.0 (Section 3.13 Default + Case Algorithm) »²¾È¡£ + */ +MSymbol Mcased; + +/*=*/ +/***en + @brief Key for values used in case operation. + + The symbol #Msoft_dotted has the name "soft-dotted" and + is used as the key of charater property. The value of such a + property is #Mt if a character has "Soft_Dotted" property, and + #Mnil otherwise. See the Unicode Standard 5.0 (Section 3.13 + Default Case Algorithm) for the detail. */ + +/***ja + @brief Case ½èÍý¤ËÍѤ¤¤é¤ì¤ëÃͤΥ­¡¼. + + ¥·¥ó¥Ü¥ë #Msoft_dotted ¤Ï¡¢"soft-dotted" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢ + ʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Ê¸»ú¤¬ + "Soft_Dotted"¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¾ì¹ç¤Ë¤Ï #Mt, ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð #Mnil ¤Ç + ¤¢¤ë¡£ ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢the Unicode Standard 5.0 (Section 3.13 + Default Case Algorithm) »²¾È¡£ + */ +MSymbol Msoft_dotted; + +/*=*/ +/***en + @brief Key for values used in case operation. + + The symbol #Mcase_mapping has the name "case-mapping" and + is used as the key of charater property. The value of such a + property is a plist of three M-Texts; lower, title, and upper of + the corresponding character. See the Unicode Standard 5.0 + (Section 5.18 Case Mappings) for the detail. */ + +/***ja + @brief Case ½èÍý¤ËÍѤ¤¤é¤ì¤ëÃͤΥ­¡¼. + + ¥·¥ó¥Ü¥ë #Mcase_mapping ¤Ï¡¢"case-mapping" ¤È¤¤¤¦Ì¾Á°¤ò¤â + ¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢£³¤Ä + ¤Î M-text¡¢¤¹¤Ê¤ï¤Á¤½¤Îʸ»ú¤Î lower, title, ¤È upper¤«¤é¤Ê¤ë plist + ¤Ç¤¢¤ë¡£ ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢the Unicode Standard 5.0 (Section 3.13 + Default Case Algorithm) »²¾È¡£ +*/ +MSymbol Mcase_mapping; + +/*=*/ +/***en + @brief Key for script block name. + + The symbol #Mblock the name "block" and is used as the + key of charater property. The value of such a property is a + symbol representing a script block of the corresponding + character. */ +/***ja + @brief ¥¹¥¯¥ê¥×¥È¥Ö¥í¥Ã¥¯Ì¾¤òɽ¤¹¥­¡¼. + + ¥·¥ó¥Ü¥ë #Mblock ¤Ï¡¢"block" ¤È¤¤¤¦Ì¾Á°¤ò¤â¤Á¡¢Ê¸»ú¥×¥í¥Ñ + ¥Æ¥£¤Î¥­¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¤½¤Îʸ»ú¤Î¥¹¥¯¥ê¥× + ¥È¥Ö¥í¥Ã¥¯Ì¾¤òɽ¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£*/ +MSymbol Mblock; + /*** @} */ /*=*/ diff --git a/src/charset.c b/src/charset.c index 8675a31..88649fd 100644 --- a/src/charset.c +++ b/src/charset.c @@ -76,6 +76,7 @@ ¥³¡¼¥É¥Ý¥¤¥ó¥È¤«¤éʸ»ú¥³¡¼¥É¤Ø¤ÎÊÑ´¹¤ò @e ¥Ç¥³¡¼¥É ¤È¸Æ¤Ó¡¢Ê¸»ú¥³¡¼¥É¤«¤é¥³¡¼¥É¥Ý¥¤¥ó¥È¤Ø¤ÎÊÑ´¹¤ò @e ¥¨¥ó¥³¡¼¥É ¤È¸Æ¤Ö¡£ */ + /*=*/ #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE) /*** @addtogroup m17nInternal @@ -352,7 +353,8 @@ load_charset (FILE *fp, MSymbol charset_name) char buf[256]; ungetc (c, fp); - fgets (buf, 256, fp); + if (! fgets (buf, 256, fp)) + break; if (c != '#') { if (sscanf (buf, "0x%x-0x%x 0x%x", &code1, &code2, &c1) == 3) @@ -837,13 +839,6 @@ MSymbol Mcharset_binary; /*** @{ */ /*=*/ -/***en - Parameter key for mchar_define_charset () (which see). */ - -/***ja - ´Ø¿ô mchar_define_charset () ÍѤΥѥé¥á¡¼¥¿¡¦¥­¡¼. - ¾Ü¤·¤¯¤Ï¤³¤Î´Ø¿ô¤Î²òÀâ¤ò»²¾È¤Î¤³¤È¡£*/ - MSymbol Mmethod; MSymbol Mdimension; MSymbol Mmin_range; @@ -867,7 +862,7 @@ MSymbol Maliases; @name Variables: Symbols representing charset methods. These are the predefined symbols that can be a value of the - #Mmethod parameter of a charset used in an argument to the + @b Mmethod parameter of a charset used in an argument to the mchar_define_charset () function. A method specifies how code-points and character codes are @@ -878,7 +873,7 @@ MSymbol Maliases; @name ÊÑ¿ô: ʸ»ú¥»¥Ã¥È¤Î¥á¥½¥Ã¥É»ØÄê¤Ë»È¤ï¤ì¤ë¥·¥ó¥Ü¥ë ¤³¤ì¤é¤Ï¡¢Ê¸»ú¥»¥Ã¥È¤Î @e ¥á¥½¥Ã¥É ¤ò»ØÄꤹ¤ë¤¿¤á¤ÎÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë¤Ç¤¢¤ê¡¢Ê¸»ú¥»¥Ã¥È¤Î - #Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤʤ뤳¤È¤¬¤Ç¤­¤ë¡£ + @b Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤʤ뤳¤È¤¬¤Ç¤­¤ë¡£ ¤³¤ÎÃͤϴؿô mchar_define_charset () ¤Î°ú¿ô¤È¤·¤Æ»È¤ï¤ì¤ë¡£ ¥á¥½¥Ã¥É¤È¤Ï¡¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥³¡¼¥É¤òÁê¸ßÊÑ´¹¤¹¤ëºÝ¤ÎÊý¼°¤Î¤³¤È¤Ç¤¢¤ë¡£ @@ -889,7 +884,7 @@ MSymbol Maliases; @brief Symbol for the offset type method of charset. The symbol #Moffset has the name "offset" and, when used - as a value of #Mmethod parameter of a charset, it means that the + as a value of @b Mmethod parameter of a charset, it means that the conversion of code-points and character codes of the charset is done by this calculation: @@ -897,21 +892,21 @@ MSymbol Maliases; CHARACTER-CODE = CODE-POINT - MIN-CODE + MIN-CHAR @endverbatim - where, MIN-CODE is a value of #Mmin_code parameter of the charset, - and MIN-CHAR is a value of #Mmin_char parameter. */ + where, MIN-CODE is a value of @b Mmin_code parameter of the charset, + and MIN-CHAR is a value of @b Mmin_char parameter. */ /***ja @brief ¥ª¥Õ¥»¥Ã¥È·¿¤Î¥á¥½¥Ã¥É¤ò¼¨¤¹¥·¥ó¥Ü¥ë. ¥·¥ó¥Ü¥ë #Moffset ¤Ï "offset" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥»¥Ã¥È¤Î - #Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥»¥Ã¥È¤Îʸ»ú¥³¡¼¥É¤Î´Ö¤ÎÊÑ´¹¤¬°Ê²¼¤Î¼°¤Ë½¾¤Ã¤Æ¹Ô¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ + @b Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥»¥Ã¥È¤Îʸ»ú¥³¡¼¥É¤Î´Ö¤ÎÊÑ´¹¤¬°Ê²¼¤Î¼°¤Ë½¾¤Ã¤Æ¹Ô¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ @verbatim ʸ»ú¥³¡¼¥É = ¥³¡¼¥É¥Ý¥¤¥ó¥È - MIN-CODE + MIN-CHAR @endverbatim - ¤³¤³¤Ç¡¢MIN-CODE ¤Ïʸ»ú¥»¥Ã¥È¤Î #Mmin_code ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤǤ¢¤ê¡¢MIN-CHAR ¤Ï - #Mmin_char ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤǤ¢¤ë¡£ */ + ¤³¤³¤Ç¡¢MIN-CODE ¤Ïʸ»ú¥»¥Ã¥È¤Î @b Mmin_code ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤǤ¢¤ê¡¢MIN-CHAR ¤Ï + @b Mmin_char ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤǤ¢¤ë¡£ */ MSymbol Moffset; /*=*/ @@ -919,16 +914,16 @@ MSymbol Moffset; /***en @brief Symbol for the map type method of charset. The symbol #Mmap has the name "map" and, when used as a - value of #Mmethod parameter of a charset, it means that the + value of @b Mmethod parameter of a charset, it means that the conversion of code-points and character codes of the charset is - done by map looking up. The map must be given by #Mmapfile + done by map looking up. The map must be given by @b Mmapfile parameter. */ /***ja @brief ¥Þ¥Ã¥×·¿¤Î¥á¥½¥Ã¥É¤ò¼¨¤¹¥·¥ó¥Ü¥ë. ¥·¥ó¥Ü¥ë #Mmap ¤Ï "map" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥»¥Ã¥È¤Î - #Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥»¥Ã¥È¤Îʸ»ú¥³¡¼¥É¤Î´Ö¤ÎÊÑ´¹¤¬¥Þ¥Ã¥×¤ò»²¾È¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¹Ô¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ - ¥Þ¥Ã¥×¤Ï #Mmapfile ¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÍ¿¤¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */ + @b Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥»¥Ã¥È¤Îʸ»ú¥³¡¼¥É¤Î´Ö¤ÎÊÑ´¹¤¬¥Þ¥Ã¥×¤ò»²¾È¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¹Ô¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ + ¥Þ¥Ã¥×¤Ï @b Mmapfile ¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÍ¿¤¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */ MSymbol Mmap; /*=*/ @@ -936,10 +931,10 @@ MSymbol Mmap; /***en @brief Symbol for the unify type method of charset. The symbol #Munify has the name "unify" and, when used as - a value of #Mmethod parameter of a charset, it means that the + a value of @b Mmethod parameter of a charset, it means that the conversion of code-points and character codes of the charset is done by map looking up and offsetting. The map must be given by - #Mmapfile parameter. For this kind of charset, a unique + @b Mmapfile parameter. For this kind of charset, a unique continuous character code space for all characters is assigned. If the map has an entry for a code-point, the conversion is done @@ -950,15 +945,15 @@ MSymbol Mmap; CHARACTER-CODE = CODE-POINT - MIN-CODE + LOWEST-CHAR-CODE @endverbatim - where, MIN-CODE is a value of #Mmin_code parameter of the charset, + where, MIN-CODE is a value of @b Mmin_code parameter of the charset, and LOWEST-CHAR-CODE is the lowest character code of the assigned code space. */ /***ja @brief ¥æ¥Ë¥Õ¥¡¥¤·¿¤Î¥á¥½¥Ã¥É¤ò¼¨¤¹¥·¥ó¥Ü¥ë. - ¥·¥ó¥Ü¥ë #Minherit ¤Ï "unify" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥»¥Ã¥È¤Î - #Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥»¥Ã¥È¤Îʸ»ú¥³¡¼¥É¤Î´Ö¤ÎÊÑ´¹¤¬¡¢¥Þ¥Ã¥×¤Î»²¾È¤È¥ª¥Õ¥»¥Ã¥È¤ÎÁȤ߹ç¤ï¤»¤Ë¤è¤Ã¤Æ¹Ô¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ - ¥Þ¥Ã¥×¤Ï #Mmapfile ¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÍ¿¤¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ + ¥·¥ó¥Ü¥ë #Munify ¤Ï "unify" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥»¥Ã¥È¤Î + @b Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥»¥Ã¥È¤Îʸ»ú¥³¡¼¥É¤Î´Ö¤ÎÊÑ´¹¤¬¡¢¥Þ¥Ã¥×¤Î»²¾È¤È¥ª¥Õ¥»¥Ã¥È¤ÎÁȤ߹ç¤ï¤»¤Ë¤è¤Ã¤Æ¹Ô¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ + ¥Þ¥Ã¥×¤Ï @b Mmapfile ¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÍ¿¤¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ ¤³¤Î¼ï¤Î³Æʸ»ú¥»¥Ã¥È¤Ë¤Ï¡¢Á´Ê¸»ú¤ËÂФ·¤ÆϢ³¤¹¤ë¥³¡¼¥É¥¹¥Ú¡¼¥¹¤¬¤½¤ì¤¾¤ì³ä¤êÅö¤Æ¤é¤ì¤ë¡£ ¥³¡¼¥É¥Ý¥¤¥ó¥È¤¬¥Þ¥Ã¥×¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ì¤Ð¡¢ÊÑ´¹¤Ï¥Þ¥Ã¥×»²¾È¤Ë¤è¤Ã¤Æ¹Ô¤ï¤ì¤ë¡£ @@ -968,7 +963,7 @@ CHARACTER-CODE = CODE-POINT - MIN-CODE + LOWEST-CHAR-CODE CHARACTER-CODE = CODE-POINT - MIN-CODE + LOWEST-CHAR-CODE @endverbatim - ¤³¤³¤Ç¡¢MIN-CODE ¤Ïʸ»ú¥»¥Ã¥È¤Î #Mmin_code ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤǤ¢¤ê¡¢ + ¤³¤³¤Ç¡¢MIN-CODE ¤Ïʸ»ú¥»¥Ã¥È¤Î @b Mmin_code ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤǤ¢¤ê¡¢ LOWEST-CHAR-CODE ¤Ï³ä¤êÅö¤Æ¤é¤ì¤¿¥³¡¼¥É¥¹¥Ú¡¼¥¹¤ÎºÇ¤â¾®¤µ¤¤Ê¸»ú¥³¡¼¥É¤Ç¤¢¤ë¡£ */ @@ -979,9 +974,9 @@ MSymbol Munify; @brief Symbol for the subset type method of charset. The symbol #Msubset has the name "subset" and, when used - as a value of #Mmethod parameter of a charset, it means that the + as a value of @b Mmethod parameter of a charset, it means that the charset is a subset of a parent charset. The parent charset must - be given by #Mparents parameter. The conversion of code-points + be given by @b Mparents parameter. The conversion of code-points and character codes of the charset is done conceptually by this calculation: @@ -991,13 +986,13 @@ CHARACTER-CODE = PARENT-CODE (CODE-POINT) + SUBSET-OFFSET where, PARENT-CODE is a pseudo function that returns a character code of CODE-POINT in the parent charset, and SUBSET-OFFSET is a - value given by #Msubset_offset parameter. */ + value given by @b Msubset_offset parameter. */ /***ja @brief ¥µ¥Ö¥»¥Ã¥È·¿¤Î¥á¥½¥Ã¥É¤ò¼¨¤¹¥·¥ó¥Ü¥ë. ¥·¥ó¥Ü¥ë #Msubset ¤Ï "subset" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥»¥Ã¥È¤Î - #Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¤³¤Îʸ»ú¥»¥Ã¥È¤¬Ê̤Îʸ»ú¥»¥Ã¥È¡Ê¿Æʸ»ú¥»¥Ã¥È¡Ë¤ÎÉôʬ½¸¹ç¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ - ¿Æʸ»ú¥»¥Ã¥È¤Ï #Mparents ¥Ñ¥é¥á¡¼¥¿¤Ë¤è¤Ã¤ÆÍ¿¤¨¤é¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ + @b Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¤³¤Îʸ»ú¥»¥Ã¥È¤¬Ê̤Îʸ»ú¥»¥Ã¥È¡Ê¿Æʸ»ú¥»¥Ã¥È¡Ë¤ÎÉôʬ½¸¹ç¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ + ¿Æʸ»ú¥»¥Ã¥È¤Ï @b Mparents ¥Ñ¥é¥á¡¼¥¿¤Ë¤è¤Ã¤ÆÍ¿¤¨¤é¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ ¥³¡¼¥É¥Ý¥¤¥ó¥È¤Èʸ»ú¥»¥Ã¥È¤Îʸ»ú¥³¡¼¥É¤Î´Ö¤ÎÊÑ´¹¤Ï¡¢³µÇ°Åª¤Ë¤Ï°Ê²¼¤Î¼°¤Ë½¾¤¦¡£ @verbatim @@ -1006,7 +1001,7 @@ CHARACTER-CODE = PARENT-CODE (CODE-POINT) + SUBSET-OFFSET ¤³¤³¤Ç PARENT-CODE ¤Ï CODE-POINT ¤Î¿Æʸ»ú¥»¥Ã¥ÈÃæ¤Ç¤Îʸ»ú¥³¡¼¥É¤òÊÖ¤¹µ¼´Ø¿ô¤Ç¤¢¤ê¡¢SUBSET-OFFSET ¤Ï - #Msubset_offset ¥Ñ¥é¥á¡¼¥¿¤ÇÍ¿¤¨¤é¤ì¤ëÃͤǤ¢¤ë¡£ + @b Msubset_offset ¥Ñ¥é¥á¡¼¥¿¤ÇÍ¿¤¨¤é¤ì¤ëÃͤǤ¢¤ë¡£ */ MSymbol Msubset; @@ -1016,16 +1011,16 @@ MSymbol Msubset; @brief Symbol for the superset type method of charset. The symbol #Msuperset has the name "superset" and, when - used as a value of #Mmethod parameter of a charset, it means that + used as a value of @b Mmethod parameter of a charset, it means that the charset is a superset of parent charsets. The parent charsets - must be given by #Mparents parameter. */ + must be given by @b Mparents parameter. */ /***ja @brief ¥¹¡¼¥Ñ¡¼¥»¥Ã¥È·¿¤Î¥á¥½¥Ã¥É¤ò¼¨¤¹¥·¥ó¥Ü¥ë. ¥·¥ó¥Ü¥ë #Msuperset ¤Ï "superset" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥»¥Ã¥È¤Î - #Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¤³¤Îʸ»ú¥»¥Ã¥È¤¬Ê̤Îʸ»ú¥»¥Ã¥È¡Ê¿Æʸ»ú¥»¥Ã¥È¡Ë¤Î¾å°Ì½¸¹ç¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ - ¿Æʸ»ú¥»¥Ã¥È¤Ï #Mparents ¥Ñ¥é¥á¡¼¥¿¤Ë¤è¤Ã¤ÆÍ¿¤¨¤é¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ + @b Mmethod ¥Ñ¥é¥á¡¼¥¿¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¤³¤Îʸ»ú¥»¥Ã¥È¤¬Ê̤Îʸ»ú¥»¥Ã¥È¡Ê¿Æʸ»ú¥»¥Ã¥È¡Ë¤Î¾å°Ì½¸¹ç¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ + ¿Æʸ»ú¥»¥Ã¥È¤Ï @b Mparents ¥Ñ¥é¥á¡¼¥¿¤Ë¤è¤Ã¤ÆÍ¿¤¨¤é¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */ MSymbol Msuperset; @@ -1041,24 +1036,24 @@ MSymbol Msuperset;
    -
  • Key is #Mmethod, value is a symbol. +
  • Key is @b Mmethod, value is a symbol. The value specifies the method for decoding/encoding code-points in the charset. It must be #Moffset, #Mmap (default), #Munify, #Msubset, or #Msuperset. -
  • Key is #Mdimension, value is an integer +
  • Key is @b Mdimension, value is an integer The value specifies the dimension of code-points of the charset. It must be 1 (default), 2, 3, or 4. -
  • Key is #Mmin_range, value is an unsigned integer +
  • Key is @b Mmin_range, value is an unsigned integer The value specifies the minimum range of a code-point, which means that the Nth byte of the value is the minimum Nth byte of code-points of the charset. The default value is 0. -
  • Key is #Mmax_range, value is an unsigned integer +
  • Key is @b Mmax_range, value is an unsigned integer The value specifies the maximum range of a code-point, which means that the Nth byte of the value is the maximum Nth byte of @@ -1066,29 +1061,29 @@ MSymbol Msuperset; 0xFFFFFF, or 0xFFFFFFFF if the dimension is 1, 2, 3, or 4 respectively. -
  • Key is #Mmin_code, value is an unsigned integer +
  • Key is @b Mmin_code, value is an unsigned integer The value specifies the minimum code-point of the charset. The default value is the minimum range. -
  • Key is #Mmax_code, value is an unsigned integer +
  • Key is @b Mmax_code, value is an unsigned integer The value specifies the maximum code-point of the charset. The default value is the maximum range. -
  • Key is #Mascii_compatible, value is a symbol +
  • Key is @b Mascii_compatible, value is a symbol The value specifies whether the charset is ASCII compatible or not. If the value is #Mnil (default), it is not ASCII compatible, else compatible. -
  • Key is #Mfinal_byte, value is an integer +
  • Key is @b Mfinal_byte, value is an integer The value specifies the @e final @e byte of the charset registered in The International Registry. It must be 0 (default) or 32..127. The value 0 means that the charset is not in the registry. -
  • Key is #Mrevision, value is an integer +
  • Key is @b Mrevision, value is an integer The value specifies the @e revision @e number of the charset registered in The International Registry. It must be 0..127. If @@ -1096,12 +1091,12 @@ MSymbol Msuperset; ignored. The value 0 means that the charset has no revision number. -
  • Key is #Mmin_char, value is an integer +
  • Key is @b Mmin_char, value is an integer The value specifies the minimum character code of the charset. The default value is 0. -
  • Key is #Mmapfile, value is an M-text +
  • Key is @b Mmapfile, value is an M-text If the method is #Mmap or #Munify, a data that contains mapping information is added to the m17n database by calling @@ -1110,7 +1105,7 @@ MSymbol Msuperset; Otherwise, this parameter is ignored. -
  • Key is #Mparents, value is a plist +
  • Key is @b Mparents, value is a plist If the method is #Msubset, the value must is a plist of length 1, and the value of the plist must be a symbol representing a @@ -1122,7 +1117,7 @@ MSymbol Msuperset; Otherwise, this parameter is ignored. -
  • Key is #Mdefine_coding, value is a symbol +
  • Key is @b Mdefine_coding, value is a symbol If the dimension of the charset is 1, the value specifies whether or not to define a coding system of the same name whose type is @@ -1146,62 +1141,62 @@ MSymbol Msuperset;
      -
    • ¥­¡¼¤¬ #Mmethod ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ +
    • ¥­¡¼¤¬ @b Mmethod ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ Ãͤϡ¢#Moffset, #Mmap (¥Ç¥Õ¥©¥ë¥ÈÃÍ), #Munify, #Msubset, #Msuperset ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢Ê¸»ú¥»¥Ã¥È¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤ò¥Ç¥³¡¼¥É¡¿¥¨¥ó¥³¡¼¥É¤¹¤ëºÝ¤Î¥á¥½¥Ã¥É¤ò»ØÄꤹ¤ë¡£ -
    • ¥­¡¼¤¬ #Mdimension ¤ÇÃͤ¬À°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mdimension ¤ÇÃͤ¬À°¿ôÃͤλþ Ãͤϡ¢1 (¥Ç¥Õ¥©¥ë¥ÈÃÍ), 2, 3, 4 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢Ê¸»ú¥»¥Ã¥È¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤Î¼¡¸µ¤Ç¤¢¤ë¡£ -
    • ¥­¡¼¤¬ #Mmin_range ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mmin_range ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ Ãͤϥ³¡¼¥É¥Ý¥¤¥ó¥È¤ÎºÇ¾®¤ÎÃͤǤ¢¤ë¡£¤¹¤Ê¤ï¤Á¡¢¤³¤ÎÃͤΠN ÈÖÌܤΥХ¤¥È¤Ï¤³¤Îʸ»ú¥»¥Ã¥È¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤Î N ÈÖÌܤΥХ¤¥È¤ÎºÇ¾®¤Î¤â¤Î¤È¤Ê¤ë¡£ ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï 0 ¡£ -
    • ¥­¡¼¤¬ #Mmax_range ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mmax_range ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ Ãͤϥ³¡¼¥É¥Ý¥¤¥ó¥È¤ÎºÇÂç¤ÎÃͤǤ¢¤ë¡£¤¹¤Ê¤ï¤Á¡¢¤³¤ÎÃͤΠN ÈÖÌܤΥХ¤¥È¤Ï¤³¤Îʸ»ú¥»¥Ã¥È¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤Î N ÈÖÌܤΥХ¤¥È¤ÎºÇÂç¤Î¤â¤Î¤È¤Ê¤ë¡£ ¥Ç¥Õ¥©¥ë¥ÈÃͤϡ¢¥³¡¼¥É¥Ý¥¤¥ó¥È¤Î¼¡¸µ¤¬ 1, 2, 3, 4 ¤Î»þ¡¢¤½¤ì¤¾¤ì 0xFF, 0xFFFF, 0xFFFFFF, 0xFFFFFFFF ¡£ -
    • ¥­¡¼¤¬ #Mmin_code ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mmin_code ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ ÃͤϤ³¤Îʸ»ú¥»¥Ã¥È¤ÎºÇ¾®¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤Ç¤¢¤ë¡£¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï - #Mmin_range ¤ÎÃÍ¡£ + @b Mmin_range ¤ÎÃÍ¡£ -
    • ¥­¡¼¤¬ #Mmax_code ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mmax_code ¤ÇÃͤ¬ÈóÉéÀ°¿ôÃͤλþ ÃͤϤ³¤Îʸ»ú¥»¥Ã¥È¤ÎºÇÂç¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤Ç¤¢¤ë¡£¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï - #Mmax_range ¤ÎÃÍ¡£ + @b Mmax_range ¤ÎÃÍ¡£ -
    • ¥­¡¼¤¬ #Mascii_compatible ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ +
    • ¥­¡¼¤¬ @b Mascii_compatible ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ ÃͤϤ³¤Îʸ»ú¥»¥Ã¥È¤¬ ASCII ¸ß´¹¤Ç¤¢¤ë¤«¤É¤¦¤«¤ò¼¨¤¹¡£¥Ç¥Õ¥©¥ë¥ÈÃͤΠ#Mnil ¤Ç¤¢¤ì¤Ð¸ß´¹¤Ç¤Ï¤Ê¤¯¡¢¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¸ß´¹¤Ç¤¢¤ë¡£ -
    • ¥­¡¼¤¬ #Mfinal_byte ¤ÇÃͤ¬À°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mfinal_byte ¤ÇÃͤ¬À°¿ôÃͤλþ ÃͤϤ³¤Îʸ»ú¥»¥Ã¥È¤Î The International Registry ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë @e ½ªÃ¼¥Ð¥¤¥È ¤Ç¤¢¤ê¡¢0 (¥Ç¥Õ¥©¥ë¥ÈÃÍ) ¤Ç¤¢¤ë¤« 32..127 ¤Ç¤¢¤ë¡£0 ¤ÏÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ -
    • ¥­¡¼¤¬ #Mrevision ¤ÇÃͤ¬À°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mrevision ¤ÇÃͤ¬À°¿ôÃͤλþ ÃÍ¤Ï The International Registry ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë @e revision @e number ¤Ç¤¢¤ê¡¢0..127 ¤Ç¤¢¤ë¡£ ʸ»ú¥»¥Ã¥È¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¤³¤ÎÃͤÏ̵»ë¤µ¤ì¤ë¡£ 0 ¤Ï revision number ¤¬Â¸ºß¤·¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ -
    • ¥­¡¼¤¬ #Mmin_char ¤ÇÃͤ¬À°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mmin_char ¤ÇÃͤ¬À°¿ôÃͤλþ ÃͤϤ³¤Îʸ»ú¥»¥Ã¥È¤ÎºÇ¾®¤Îʸ»ú¥³¡¼¥É¤Ç¤¢¤ë¡£¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï 0 ¡£ -
    • ¥­¡¼¤¬ #Mmapfile ¤ÇÃͤ¬ M-text ¤Î»þ +
    • ¥­¡¼¤¬ @b Mmapfile ¤ÇÃͤ¬ M-text ¤Î»þ ¥á¥½¥Ã¥É¤¬ #Mmap ¤« #Munify ¤Î»þ¡¢´Ø¿ô mdatabase_define () ¤ò¤³¤ÎÃͤò°ú¿ô $EXTRA_INFO ¤È¤·¤Æ¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤Æ¡¢¥Þ¥Ã¥Ô¥ó¥°¤Ë´Ø¤¹¤ë¥Ç¡¼¥¿¤¬ @@ -1210,7 +1205,7 @@ MSymbol Msuperset; ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢¤³¤Î¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ -
    • ¥­¡¼¤¬ #Mparents ¤ÇÃͤ¬ plist ¤Î»þ +
    • ¥­¡¼¤¬ @b Mparents ¤ÇÃͤ¬ plist ¤Î»þ ¥á¥½¥Ã¥É¤¬ #Msubset ¤Ê¤é¤Ð¡¢ÃͤÏŤµ 1 ¤Î plist ¤Ç¤¢¤ê¡¢¤½¤ÎÃͤϤ³¤Îʸ»ú¥»¥Ã¥È¤Î¾å°Ì½¸¹ç¤È¤Ê¤ëʸ»ú¥»¥Ã¥È¤ò¼¨¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£ @@ -1220,7 +1215,7 @@ MSymbol Msuperset; ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢¤³¤Î¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ -
    • ¥­¡¼¤¬ #Mdefine_coding ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ +
    • ¥­¡¼¤¬ @b Mdefine_coding ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ ʸ»ú¥»¥Ã¥È¤Î¼¡¸µ¤¬ 1 ¤Ê¤é¤Ð¡¢Ãͤ¬ #Mnil °Ê³°¤Î¾ì¹ç¤Ë #Mcharset ·¿ ¤ÇƱ¤¸Ì¾Á°¤ò»ý¤Ä¥³¡¼¥É·Ï¤òÄêµÁ¤¹¤ë¡£ diff --git a/src/coding.c b/src/coding.c index b991c83..c241358 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1,5 +1,5 @@ /* coding.c -- code conversion module. - Copyright (C) 2003, 2004 + Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -1783,8 +1783,10 @@ decode_coding_iso_2022 (const unsigned char *source, int src_bytes, MText *mt, else goto invalid_byte; /* We must update these variables now. */ - charset0 = status->designation[status->invocation[0]]; - charset1 = status->designation[status->invocation[1]]; + if (status->invocation[0] >= 0) + charset0 = status->designation[status->invocation[0]]; + if (status->invocation[1] >= 0) + charset1 = status->designation[status->invocation[1]]; continue; case 'n': /* invocation of locking-shift-2 */ @@ -1936,8 +1938,10 @@ decode_coding_iso_2022 (const unsigned char *source, int src_bytes, MText *mt, else goto invalid_byte; /* We must update these variables now. */ - charset0 = status->designation[status->invocation[0]]; - charset1 = status->designation[status->invocation[1]]; + if (status->invocation[0] >= 0) + charset0 = status->designation[status->invocation[0]]; + if (status->invocation[1] >= 0) + charset1 = status->designation[status->invocation[1]]; continue; unused_escape_sequence: @@ -3002,6 +3006,9 @@ mcoding__init (void) NULL, NULL, NULL, NULL); mplist_put (param, Mtype, Mnil); + pl = mplist (); + mplist_add (pl, Msymbol, msymbol ("Shift_JIS")); + mplist_put (param, Maliases, pl); mplist_set (charsets, Msymbol, Mcharset_ascii); Mcoding_sjis = mconv_define_coding ("sjis", param, reset_coding_sjis, @@ -3010,6 +3017,7 @@ mcoding__init (void) M17N_OBJECT_UNREF (charsets); M17N_OBJECT_UNREF (param); + M17N_OBJECT_UNREF (pl); return 0; } @@ -3307,8 +3315,6 @@ MSymbol Mcoding_sjis; /***ja mconv_define_coding () Íѥѥé¥á¡¼¥¿¥­¡¼ (¾ÜºÙ¤Ï mconv_define_coding ()»²¾È). */ MSymbol Mtype; -/*=*/ - MSymbol Mcharsets; MSymbol Mflags; MSymbol Mdesignation; @@ -3343,22 +3349,19 @@ MSymbol Miso_2022; /*=*/ /***en - @name Variables: Symbols appearing in the value of #Mflags parameter. */ + @name Variables: Symbols appearing in the value of Mflags parameter. */ /***ja - @name ÊÑ¿ô¡§ ¥Ñ¥é¥á¡¼¥¿ #Mflags ¤ÎÃͤȤʤêÆÀ¤ë¥·¥ó¥Ü¥ë. */ + @name ÊÑ¿ô¡§ ¥Ñ¥é¥á¡¼¥¿ Mflags ¤ÎÃͤȤʤêÆÀ¤ë¥·¥ó¥Ü¥ë. */ /*** @{ */ -/*=*/ - /***en - Symbols that can be a value of the #Mflags parameter of a coding + Symbols that can be a value of the @b Mflags parameter of a coding system used in an argument to the mconv_define_coding () function (which see). */ /***ja ´Ø¿ô mconv_define_coding () ¤Î°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¥³¡¼¥É·Ï¤Î¥Ñ¥é¥á¡¼¥¿ - #Mflags ¤ÎÃͤȤʤêÆÀ¤ë¥·¥ó¥Ü¥ë¡£(¾ÜºÙ¤Ï + @b Mflags ¤ÎÃͤȤʤêÆÀ¤ë¥·¥ó¥Ü¥ë¡£(¾ÜºÙ¤Ï mconv_define_coding ()»²¾È)¡£ */ MSymbol Mreset_at_eol; -/*=*/ MSymbol Mreset_at_cntl; MSymbol Meight_bit; MSymbol Mlong_form; @@ -3377,7 +3380,7 @@ MSymbol Mfull_support; /*=*/ /***en - @name Variables: etc + @name Variables: Others Remaining variables. */ /***ja @name ÊÑ¿ô: ¤½¤Î¾ @@ -3389,13 +3392,13 @@ MSymbol Mfull_support; @brief Symbol whose name is "maybe". The variable #Mmaybe is a symbol of name "maybe". It is - used a value of #Mbom parameter of the function + used a value of @b Mbom parameter of the function mconv_define_coding () (which see). */ /***ja @brief "maybe"¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. ÊÑ¿ô #Mmaybe ¤Ï "maybe" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¡£¤³¤ì¤Ï´Ø¿ô - mconv_define_coding () ¥Ñ¥é¥á¡¼¥¿ #Mbom ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤ë¡£ + mconv_define_coding () ¥Ñ¥é¥á¡¼¥¿ @b Mbom ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤ë¡£ (¾ÜºÙ¤Ï mconv_define_coding () »²¾È)¡£ */ MSymbol Mmaybe; @@ -3432,112 +3435,112 @@ MSymbol Mcoding;
    • Key is @c Mtype, value is a symbol The value specifies the type of the coding system. It must be - #Mcharset, #Mutf, #Miso_2022, or #Mnil. + @b Mcharset, @b Mutf, @b Miso_2022, or @b Mnil. - If the type is #Mcharset, $EXTRA_INFO is ignored. + If the type is @b Mcharset, $EXTRA_INFO is ignored. - If the type is #Mutf, $EXTRA_INFO must be a pointer to + If the type is @b Mutf, $EXTRA_INFO must be a pointer to #MCodingInfoUTF. - If the type is #Miso_2022, $EXTRA_INFO must be a pointer to + If the type is @b Miso_2022, $EXTRA_INFO must be a pointer to #MCodingInfoISO2022. If the type is #Mnil, the argument $RESETTER, $DECODER, and $ENCODER must be supplied. $EXTRA_INFO is ignored. Otherwise, they can be @c NULL and the m17n library provides proper defaults. -
    • Key is #Mcharsets, value is a plist +
    • Key is @b Mcharsets, value is a plist The value specifies a list charsets supported by the coding system. The keys of the plist must be #Msymbol, and the values must be symbols representing charsets. -
    • Key is #Mflags, value is a plist +
    • Key is @b Mflags, value is a plist - If the type is #Miso_2022, the values specifies flags to control + If the type is @b Miso_2022, the values specifies flags to control the ISO 2022 interpreter. The keys of the plist must e #Msymbol, and values must be one of the following.
        -
      • #Mreset_at_eol +
      • @b Mreset_at_eol If this flag exists, designation and invocation status is reset to the initial state at the end of line. -
      • #Mreset_at_cntl +
      • @b Mreset_at_cntl If this flag exists, designation and invocation status is reset to the initial state at a control character. -
      • #Meight_bit +
      • @b Meight_bit If this flag exists, the graphic plane right is used. -
      • #Mlong_form +
      • @b Mlong_form If this flag exists, the over-long escape sequences (ESC '$' '(' - ) are used for designating the CCS JISX0208.1978, + \) are used for designating the CCS JISX0208.1978, GB2312, and JISX0208. -
      • #Mdesignation_g0 +
      • @b Mdesignation_g0 - If this flag and #Mfull_support exists, designates charsets not + If this flag and @b Mfull_support exists, designates charsets not listed in the charset list to the graphic register G0. -
      • #Mdesignation_g1 +
      • @b Mdesignation_g1 - If this flag and #Mfull_support exists, designates charsets not + If this flag and @b Mfull_support exists, designates charsets not listed in the charset list to the graphic register G1. -
      • #Mdesignation_ctext +
      • @b Mdesignation_ctext - If this flag and #Mfull_support exists, designates charsets not + If this flag and @b Mfull_support exists, designates charsets not listed in the charset list to a graphic register G0 or G1 based on the criteria of the Compound Text. -
      • #Mdesignation_ctext_ext +
      • @b Mdesignation_ctext_ext - If this flag and #Mfull_support exists, designates charsets not + If this flag and @b Mfull_support exists, designates charsets not listed in the charset list to a graphic register G0 or G1, or use extended segment for such charsets based on the criteria of the Compound Text. -
      • #Mlocking_shift +
      • @b Mlocking_shift If this flag exists, use locking shift. -
      • #Msingle_shift +
      • @b Msingle_shift If this flag exists, use single shift. -
      • #Msingle_shift_7 +
      • @b Msingle_shift_7 If this flag exists, use 7-bit single shift code (0x19). -
      • #Meuc_tw_shift +
      • @b Meuc_tw_shift If this flag exists, use a special shifting according to EUC-TW. -
      • #Miso_6429 +
      • @b Miso_6429 This flag is currently ignored. -
      • #Mrevision_number +
      • @b Mrevision_number If this flag exists, use a revision number escape sequence to designate a charset that has a revision number. -
      • #Mfull_support +
      • @b Mfull_support If this flag exists, support all charsets registered in the International Registry.
      -
    • Key is #Mdesignation, value is a plist +
    • Key is @b Mdesignation, value is a plist - If the type is #Miso_2022, the value specifies how to designate + If the type is @b Miso_2022, the value specifies how to designate each supported characters. The keys of the plist must be #Minteger, and the values must be numbers indicating a graphic registers. The Nth element value is for the Nth charset of the @@ -3547,9 +3550,9 @@ MSymbol Mcoding; to any register at first, and if necessary, is designated to the (G+4) graphic register. -
    • Key is #Minvocation, value is a plist +
    • Key is @b Minvocation, value is a plist - If the type is #Miso_2022, the value specifies how to invocate + If the type is @b Miso_2022, the value specifies how to invocate each graphic registers. The plist length must be one or two. The keys of the plist must be #Minteger, and the values must be numbers indicating a graphic register. The value of the first @@ -3559,22 +3562,22 @@ MSymbol Mcoding; second element specifies which graphic register is invocated to the graphic plane right. -
    • Key is #Mcode_unit, value is an integer +
    • Key is @b Mcode_unit, value is an integer - If the type is #Mutf, the value specifies the bit length of a + If the type is @b Mutf, the value specifies the bit length of a code-unit. It must be 8, 16, or 32. -
    • Key is #Mbom, value is a symbol +
    • Key is @b Mbom, value is a symbol - If the type is #Mutf and the code-unit bit length is 16 or 32, + If the type is @b Mutf and the code-unit bit length is 16 or 32, it specifies whether or not to use BOM (Byte Order Mark). If the value is #Mnil (default), BOM is not used, else if the value is #Mmaybe, the existence of BOM is detected at decoding time, else BOM is used. -
    • Key is #Mlittle_endian, value is a symbol +
    • Key is @b Mlittle_endian, value is a symbol - If the type is #Mutf and the code-unit bit length is 16 or 32, + If the type is @b Mutf and the code-unit bit length is 16 or 32, it specifies whether or not the encoding is little endian. If the value is #Mnil (default), it is big endian, else it is little endian. @@ -3630,15 +3633,15 @@ MSymbol Mcoding;
    • ¥­¡¼¤¬ @c Mtype ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ - Ãͤϥ³¡¼¥É·Ï¤Î¥¿¥¤¥×¤òɽ¤·¡¢#Mcharset, #Mutf, #Miso_2022, #Mnil + Ãͤϥ³¡¼¥É·Ï¤Î¥¿¥¤¥×¤òɽ¤·¡¢@b Mcharset, @b Mutf, @b Miso_2022, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ - ¥¿¥¤¥×¤¬ #Mcharset ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï̵»ë¤µ¤ì¤ë¡£ + ¥¿¥¤¥×¤¬ @b Mcharset ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï̵»ë¤µ¤ì¤ë¡£ - ¥¿¥¤¥×¤¬ #Mutf ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoUTF + ¥¿¥¤¥×¤¬ @b Mutf ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoUTF ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ - ¥¿¥¤¥×¤¬ #Miso_2022¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoISO2022 + ¥¿¥¤¥×¤¬ @b Miso_2022¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoISO2022 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ ¥¿¥¤¥×¤¬ #Mnil ¤Ê¤é¤Ð¡¢°ú¿ô $RESETTER, $DECODER, $ENCODER @@ -3646,92 +3649,92 @@ MSymbol Mcoding; ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ë¤Ï¤³¤ì¤é¤Ï @c NULL ¤Ç¤è¤¯¡¢ m17n ¥é¥¤¥Ö¥é¥ê¤¬Å¬Àڤʥǥե©¥ë¥ÈÃͤòÍ¿¤¨¤ë¡£ -
    • ¥­¡¼¤¬ #Mcharsets ¤ÇÃͤ¬ plist ¤Î»þ +
    • ¥­¡¼¤¬ @b Mcharsets ¤ÇÃͤ¬ plist ¤Î»þ ÃͤϤ³¤Î¥³¡¼¥É·Ï¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤ëʸ»ú¥»¥Ã¥È¤Î¥ê¥¹¥È¤Ç¤¢¤ë¡£plist¤Î¥­¡¼¤Ï #Msymbol¡¢ÃͤÏʸ»ú¥»¥Ã¥È¤ò¼¨¤¹¥·¥ó¥Ü¥ë¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ -
    • ¥­¡¼¤¬ #Mflags Ãͤ¬ plist ¤Î»þ +
    • ¥­¡¼¤¬ @b Mflags Ãͤ¬ plist ¤Î»þ - ¥¿¥¤¥×¤¬ #Miso_2022 ¤Ê¤é¤Ð¡¢¤³¤ÎÃͤÏ, ISO 2022 + ¥¿¥¤¥×¤¬ @b Miso_2022 ¤Ê¤é¤Ð¡¢¤³¤ÎÃͤÏ, ISO 2022 ¥¤¥ó¥¿¥×¥ê¥¿ÍѤÎÀ©¸æ¥Õ¥é¥Ã¥°¤ò¼¨¤¹¡£plist ¤Î¥­¡¼¤Ï #Msymbol ¤Ç¤¢¤ê¡¢Ãͤϰʲ¼¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£
        -
      • #Mreset_at_eol +
      • @b Mreset_at_eol ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¿Þ·Áʸ»ú½¸¹ç¤Î»Ø¼¨¤ä¸Æ½Ð¤Ï¹ÔËö¤Ç¥ê¥»¥Ã¥È¤µ¤ì¤ÆÅö½é¤Î¾õÂÖ¤ËÌá¤ë¡£ -
      • #Mreset_at_cntl +
      • @b Mreset_at_cntl ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¿Þ·Áʸ»ú½¸¹ç¤Î»Ø¼¨¤ä¸Æ½Ð¤ÏÀ©¸æʸ»ú¤Ë½Ð²ñ¤Ã¤¿»þÅÀ¤Ç¥ê¥»¥Ã¥È¤µ¤ì¤ÆÅö½é¤Î¾õÂÖ¤ËÌá¤ë¡£ -
      • #Meight_bit +
      • @b Meight_bit ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¿Þ·Áʸ»ú½¸¹ç¤Î±¦È¾Ì̤¬ÍѤ¤¤é¤ì¤ë¡£ -
      • #Mlong_form +
      • @b Mlong_form ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢Ê¸»ú½¸¹ç JISX0208.1978, GB2312, JISX0208 ¤ò»Ø¼¨¤¹¤ëºÝ¤Ë over-long ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹ (ESC '$' '(' - ) ¤¬ÍѤ¤¤é¤ì¤ë¡£ + \) ¤¬ÍѤ¤¤é¤ì¤ë¡£ -
      • #Mdesignation_g0 +
      • @b Mdesignation_g0 - ¤³¤Î¥Õ¥é¥°¤È #Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò + ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò G0 ½¸¹ç¤Ë»Ø¼¨¤¹¤ë¡£ -
      • #Mdesignation_g1 +
      • @b Mdesignation_g1 - ¤³¤Î¥Õ¥é¥°¤È #Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò + ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò G1 ½¸¹ç¤Ë»Ø¼¨¤¹¤ë¡£ -
      • #Mdesignation_ctext +
      • @b Mdesignation_ctext - ¤³¤Î¥Õ¥é¥°¤È #Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò + ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò G0 ½¸¹ç¤Þ¤¿¤Ï G1 ½¸¹ç¤Ë¡¢¥³¥ó¥Ñ¥¦¥ó¥É¥Æ¥­¥¹¥È¤Î´ð½à¤Ë¤½¤Ã¤Æ»Ø¼¨¤¹¤ë¡£ -
      • #Mdesignation_ctext_ext +
      • @b Mdesignation_ctext_ext - ¤³¤Î¥Õ¥é¥°¤È #Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò + ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò G0 ½¸¹ç¤Þ¤¿¤Ï G1 ½¸¹ç¤Ë¡¢¤¢¤ë¤¤¤Ï³ÈÄ¥¥»¥°¥á¥ó¥È¤Ë¥³¥ó¥Ñ¥¦¥ó¥É¥Æ¥­¥¹¥È¤Î´ð½à¤Ë¤½¤Ã¤Æ»Ø¼¨¤¹¤ë¡£ -
      • #Mlocking_shift +
      • @b Mlocking_shift ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¥í¥Ã¥­¥ó¥°¥·¥Õ¥È¤òÍѤ¤¤ë¡£ -
      • #Msingle_shift +
      • @b Msingle_shift ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¥·¥ó¥°¥ë¥·¥Õ¥È¤òÍѤ¤¤ë¡£ -
      • #Msingle_shift_7 +
      • @b Msingle_shift_7 ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢7-bit ¥·¥ó¥°¥ë¥·¥Õ¥È¥³¡¼¥É (0x19) ¤òÍѤ¤¤ë¡£ -
      • #Meuc_tw_shift +
      • @b Meuc_tw_shift ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢EUC-TW ¤Ë±è¤Ã¤¿ÆÃÊ̤ʥ·¥Õ¥È¤òÍѤ¤¤ë¡£ -
      • #Miso_6429 +
      • @b Miso_6429 ¸½»þÅÀ¤Ç¤ÏÍѤ¤¤é¤ì¤Æ¤¤¤Ê¤¤¡£ -
      • #Mrevision_number +
      • @b Mrevision_number ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢revision number ¤ò»ý¤Äʸ»ú¥»¥Ã¥È¤ò»Ø¼¨¤¹¤ëºÝ¤Ë revision number ¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤òÍѤ¤¤ë¡£ -
      • #Mfull_support +
      • @b Mfull_support ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢the International Registry ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÁ´Ê¸»ú¥»¥Ã¥È¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
      -
    • ¥­¡¼¤¬ #Mdesignation¤ÇÃͤ¬ plist ¤Î»þ +
    • ¥­¡¼¤¬ @b Mdesignation ¤ÇÃͤ¬ plist ¤Î»þ - ¥¿¥¤¥×¤¬ #Miso_2022 ¤Ê¤é¤Ð¡¢ÃͤϳÆʸ»ú¤ò¤É¤Î¤è¤¦¤Ë»Ø¼¨¤¹¤ë¤«¤ò¼¨¤¹¡£ + ¥¿¥¤¥×¤¬ @b Miso_2022 ¤Ê¤é¤Ð¡¢ÃͤϳÆʸ»ú¤ò¤É¤Î¤è¤¦¤Ë»Ø¼¨¤¹¤ë¤«¤ò¼¨¤¹¡£ plist ¤Î¥­¡¼¤Ï #Minteger¡¢ÃͤϽ¸¹ç¡Êgraphic register¡Ë ¤ò¼¨¤¹¿ô»ú¤Ç¤¢¤ë¡£NÈÖÌܤÎÍ×ÁǤÎÃͤϡ¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Î N ÈÖÌܤÎʸ»ú¥»¥Ã¥È¤ËÂбþ¤¹¤ë¡£Ãͤ¬ 0..3 ¤Ç¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¤¬¤¹¤Ç¤Ë @@ -3740,30 +3743,30 @@ MSymbol Mcoding; Ãͤ¬Éé(-4..-1) ¤Ç¤¢¤ì¤Ð¡¢½é´ü¾õÂ֤ǤÏʸ»ú¥»¥Ã¥È¤¬¤É¤³¤Ë¤â»Ø¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¡¢É¬Í×¤ÊºÝ¤Ë¤Ï G0..G3 ¤Î¤½¤ì¤¾¤ì¤Ë»Ø¼¨¤¹¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ -
    • ¥­¡¼¤¬ #Minvocation¤ÇÃͤ¬ plist ¤Î»þ +
    • ¥­¡¼¤¬ @b Minvocation ¤ÇÃͤ¬ plist ¤Î»þ - ¥¿¥¤¥×¤¬ #Miso_2022 ¤Ê¤é¤Ð¡¢Ãͤϳƽ¸¹ç¤ò¤É¤Î¤è¤¦¤Ë¸Æ¤Ó½Ð¤¹¤«¤ò¼¨¤¹¡£ + ¥¿¥¤¥×¤¬ @b Miso_2022 ¤Ê¤é¤Ð¡¢Ãͤϳƽ¸¹ç¤ò¤É¤Î¤è¤¦¤Ë¸Æ¤Ó½Ð¤¹¤«¤ò¼¨¤¹¡£ plist ¤ÎŤµ¤Ï 1 ¤Ê¤¤¤· 2 ¤Ç¤¢¤ë¡£plist ¤Î¥­¡¼¤Ï #Minteger¡¢ÃͤϽ¸¹ç¡Êgraphic register)¤ò¼¨¤¹¿ô»ú¤Ç¤¢¤ë¡£ ºÇ½é¤ÎÍ×ÁǤÎÃͤ¬¿Þ·Áʸ»ú½¸¹çº¸È¾Ì̤˸ƤӽФµ¤ì¤ë½¸¹ç¤ò¼¨¤¹¡£ plist ¤ÎŤµ¤¬ 1 ¤Ê¤é¤Ð¡¢±¦È¾Ì̤ˤϲ¿¤â¸Æ¤Ó½Ð¤µ¤ì¤Ê¤¤¡£ ¤½¤¦¤Ç¤±¤ì¤Ð¡¢£²¤Ä¤á¤ÎÍ×ÁǤÎÃͤ¬¿Þ·Áʸ»ú½¸¹ç±¦È¾Ì̤˸ƤӽФµ¤ì¤ë½¸¹ç¤ò¼¨¤¹¡£ -
    • ¥­¡¼¤¬ #Mcode_unit ¤ÇÃͤ¬À°¿ôÃͤλþ +
    • ¥­¡¼¤¬ @b Mcode_unit ¤ÇÃͤ¬À°¿ôÃͤλþ - ¥¿¥¤¥×¤¬ #Mutf ¤Ê¤é¤Ð¡¢Ãͤϥ³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤǤ¢¤ê¡¢8, 16, + ¥¿¥¤¥×¤¬ @b Mutf ¤Ê¤é¤Ð¡¢Ãͤϥ³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤǤ¢¤ê¡¢8, 16, 32 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£ -
    • ¥­¡¼¤¬ #Mbom ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ +
    • ¥­¡¼¤¬ @b Mbom ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ - ¥¿¥¤¥×¤¬ #Mutf ¤Ç¥³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤ¬ 16 ¤« 32¤Ê¤é¤Ð¡¢ÃÍ¤Ï + ¥¿¥¤¥×¤¬ @b Mutf ¤Ç¥³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤ¬ 16 ¤« 32¤Ê¤é¤Ð¡¢ÃÍ¤Ï BOM (Byte Order Mark) ¤ò»ÈÍѤ¹¤ë¤«¤É¤¦¤«¤ò¼¨¤¹¡£Ãͤ¬¥Ç¥Õ¥©¥ë¥ÈÃͤΠ#Mnil ¤Ê¤é¤Ð¡¢»ÈÍѤ·¤Ê¤¤¡£Ãͤ¬ #Mmaybe ¤Ê¤é¤Ð¥Ç¥³¡¼¥É»þ¤Ë BOM ¤¬¤¢¤ë¤«¤É¤¦¤«¤òÄ´¤Ù¤ë¡£¤½¤ì°Ê³°¤Ê¤é¤Ð»ÈÍѤ¹¤ë¡£ -
    • ¥­¡¼¤¬ #Mlittle_endian ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ +
    • ¥­¡¼¤¬ @b Mlittle_endian ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ - ¥¿¥¤¥×¤¬ #Mutf ¤Ç¥³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤ¬ 16 ¤« 32 + ¥¿¥¤¥×¤¬ @b Mutf ¤Ç¥³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤ¬ 16 ¤« 32 ¤Ê¤é¤Ð¡¢Ãͤϥ¨¥ó¥³¡¼¥É¤¬ little endian ¤«¤É¤¦¤«¤ò¼¨¤¹¡£Ãͤ¬¥Ç¥Õ¥©¥ë¥ÈÃͤΠ#Mnil ¤Ê¤é¤Ð big endian ¤Ç¤¢¤ê¡¢¤½¤¦¤Ç¤Ê¤±¤ì¤Ð little endian ¤Ç¤¢¤ë¡£ diff --git a/src/database.c b/src/database.c index 209940d..2a1507a 100644 --- a/src/database.c +++ b/src/database.c @@ -734,11 +734,11 @@ check_version (MPlist *version) break; ver[i] = ver[i] * 10 + (*verstr - '0'); } - return (ver[0] < M17NLIB_MAJOR_VERSION + return (ver[0] > M17NLIB_MAJOR_VERSION || (ver[0] == M17NLIB_MAJOR_VERSION - && (ver[1] < M17NLIB_MINOR_VERSION + && (ver[1] > M17NLIB_MINOR_VERSION || (ver[1] == M17NLIB_MINOR_VERSION - && ver[2] <= M17NLIB_PATCH_LEVEL)))); + && ver[2] >= M17NLIB_PATCH_LEVEL)))); } /* If LOADER == load_database, extra_info is a pointer to MDatabaseInfo. */ @@ -1913,7 +1913,7 @@ mdatabase__validate (xmlDocPtr doc, MDatabaseInfo *db_info) /*** @addtogroup m17nCharset */ /*** @{ */ - +/*=*/ /***en @brief The symbol @c Mcharset. diff --git a/src/draw.c b/src/draw.c index 1ba6cf6..7fdb90c 100644 --- a/src/draw.c +++ b/src/draw.c @@ -238,29 +238,11 @@ visual_order (MGlyphString *gstring) } } -#if 0 -static void -reorder_combining_chars (MGlyphString *gstring, int from, int to) +static MSymbol +font_id (MFLTFont *font) { - MGlyph *g, *gbeg = MGLYPH (from + 1), *gend = MGLYPH (to), temp; - int reordered = 1; - - while (reordered) - { - reordered = 0; - for (g = gbeg; g != gend; g++) - if (COMBINING_CODE_CLASS (g->combining_code) > 0 - && (COMBINING_CODE_CLASS (g[-1].combining_code) - > COMBINING_CODE_CLASS (g->combining_code))) - { - reordered = 1; - temp = *g; - *g = g[-1]; - g[-1] = temp; - } - } + return ((MFLTFontForRealized *) font)->rfont->id; } -#endif static int run_flt (MGlyphString *gstring, int from, int to, MRealizedFace *rface) @@ -272,6 +254,7 @@ run_flt (MGlyphString *gstring, int from, int to, MRealizedFace *rface) MFLT *flt; int from_pos = MGLYPH (from)->g.from; int len = to - from; + int catcode; int i; flt = mflt_get (layouter); @@ -289,6 +272,9 @@ run_flt (MGlyphString *gstring, int from, int to, MRealizedFace *rface) font.font.drive_otf = rfont->driver->drive_otf; font.font.internal = NULL; font.rfont = rfont; + mflt_font_id = font_id; + mflt_iterate_otf_feature = rfont->driver->iterate_otf_feature; + mflt_try_otf = rfont->driver->try_otf; for (i = 0; i < 3; i++) { to = mflt_run (&flt_gstr, from, to, &font.font, flt); @@ -300,7 +286,7 @@ run_flt (MGlyphString *gstring, int from, int to, MRealizedFace *rface) } if (from + len != to) gstring->used += to - (from + len); - for (i = from; i < to; i++) + for (i = from, catcode = -1; i < to; i++) { MGlyph *g = MGLYPH (i); @@ -315,6 +301,17 @@ run_flt (MGlyphString *gstring, int from, int to, MRealizedFace *rface) g->g.xoff >>= 6; g->g.yoff >>= 6; g->rface = rface; + if (catcode < 0 || g->g.from != g[-1].g.from) + { + MSymbol category = mchar_get_prop (g->g.c, Mcategory); + + catcode = (category == McatCf + ? GLYPH_CATEGORY_FORMATTER + : category != Mnil && MSYMBOL_NAME (category)[0] == 'M' + ? GLYPH_CATEGORY_MODIFIER + : GLYPH_CATEGORY_NORMAL); + } + g->category = catcode; } return to; } @@ -464,7 +461,7 @@ compose_glyph_string (MFrame *frame, MText *mt, int from, int to, { MSymbol category = mchar_get_prop (g[-1].g.c, Mcategory); - if (MSYMBOL_NAME (category)[0] != 'Z') + if (category != Mnil && MSYMBOL_NAME (category)[0] != 'Z') this_script = script; } } @@ -1763,6 +1760,8 @@ mdraw__init () M_kinsoku_bol = msymbol ("kb"); M_kinsoku_eol = msymbol ("ke"); + mflt_enable_new_feature = 1; + return 0; } @@ -1969,7 +1968,7 @@ mdraw_text (MFrame *frame, MDrawWindow win, int x, int y, @return ½èÍý¤¬À®¸ù¤·¤¿¾ì¹ç¡¢mdraw_image_text () ¤Ï 0 - ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #m_errro ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£ + ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£ @latexonly \IPAlabel{mdraw_image_text} @endlatexonly */ @@ -2005,7 +2004,7 @@ mdraw_image_text (MFrame *frame, MDrawWindow win, int x, int y, this function also follows what specified in the drawing control object $CONTROL. - For instance, if of $CONTROL is nonzero, this + For instance, if \ of $CONTROL is nonzero, this function draw an M-text 2-dimensionally, i.e., newlines in M-text breaks lines and the following characters are drawn in the next line. See the documentation of the structure @ MDrawControl for @@ -2021,7 +2020,7 @@ mdraw_image_text (MFrame *frame, MDrawWindow win, int x, int y, ¥Æ¥­¥¹¥È¤ÎÉÁ²èÊýË¡¤Ï mdraw_text () ¤È¤Û¤ÜƱ¤¸¤Ç¤¢¤ë¤¬¡¢¤³¤Î´Ø¿ô¤ÏÉÁ²èÀ©¸æÍѤΥª¥Ö¥¸¥§¥¯¥È $CONTROL ¤Î»Ø¼¨¤Ë¤â½¾¤¦ÅÀ¤¬°Û¤Ê¤Ã¤Æ¤¤¤ë¡£ - ¤¿¤È¤¨¤Ð $CONTROL ¤Î ¤¬¥¼¥í¤Ç¤Ê¤±¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï + ¤¿¤È¤¨¤Ð $CONTROL ¤Î \ ¤¬¥¼¥í¤Ç¤Ê¤±¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï M-text ¤ò2¼¡¸µÅª¤ËÉÁ¤¯¡£¤¹¤Ê¤ï¤Á M-text Ãæ¤Î²þ¹Ô¤Ç¹Ô¤ò²þ¤á¡¢Â³¤¯Ê¸»ú¤Ï¼¡¤Î¹Ô¤ËÉÁ¤¯¡£¾ÜºÙ¤Ï¹½Â¤ÂÎ @ MDrawControl ¤ÎÀâÌÀ¤ò»²¾È¤¹¤ë¤³¤È¡£*/ diff --git a/src/face.c b/src/face.c index cd13c0e..f144ef5 100644 --- a/src/face.c +++ b/src/face.c @@ -1023,13 +1023,13 @@ MSymbol Mbackground; @brief Key of a face property specifying video mode. The variable #Mvideomode is used as a key of face property. The - property value must be #Mnormal, #Mreverse, or #Mnil. + property value must be @b Mnormal, @b Mreverse, or #Mnil. - #Mnormal means that an M-text is drawn in normal video mode + @b Mnormal means that an M-text is drawn in normal video mode (i.e. the foreground is drawn by foreground color, the background is drawn by background color). - #Mreverse means that an M-text is drawn in reverse video mode + @b Mreverse means that an M-text is drawn in reverse video mode (i.e. the foreground is drawn by background color, the background is drawn by foreground color). @@ -1038,12 +1038,12 @@ MSymbol Mbackground; @brief ¥Ó¥Ç¥ª¥â¡¼¥É¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼. ÊÑ¿ô #Mvideomode ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢ - #Mnormal, #Mreverse, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ + @b Mnormal, @b Mreverse, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ - #Mnormal ¤Î¾ì¹ç¤Ï¡¢M-text + @b Mnormal ¤Î¾ì¹ç¤Ï¡¢M-text ¤òɸ½à¤Î¥Ó¥Ç¥ª¥â¡¼¥É¡ÊÁ°·Ê¤òÁ°·Ê¿§¤Ç¡¢ÇطʤòÇØ·Ê¿§¤Ç¡Ë¤Çɽ¼¨¤¹¤ë¡£ - #Mreverse ¤Î¾ì¹ç¤Ï¥ê¥Ð¡¼¥¹¥Ó¥Ç¥ª¥â¡¼¥É¤Ç¡ÊÁ°·Ê¤òÇØ·Ê¿§¤Ç¡¢ÇطʤòÁ°·Ê¿§¤Ç¡Ëɽ¼¨¤¹¤ë¡£ + @b Mreverse ¤Î¾ì¹ç¤Ï¥ê¥Ð¡¼¥¹¥Ó¥Ç¥ª¥â¡¼¥É¤Ç¡ÊÁ°·Ê¤òÇØ·Ê¿§¤Ç¡¢ÇطʤòÁ°·Ê¿§¤Ç¡Ëɽ¼¨¤¹¤ë¡£ #Mnil ¤Î¾ì¹ç¤Ï¥Ó¥Ç¥ª¥â¡¼¥É¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£ */ @@ -1176,7 +1176,6 @@ MSymbol Mhook_arg; /***en @name Variables: Possible values of #Mvideomode property of face */ /***ja @name ÊÑ¿ô¡§ ¥Õ¥§¡¼¥¹¤Î #Mvideomode ¥×¥í¥Ñ¥Æ¥£¤Î²Äǽ¤ÊÃÍ */ /*** @{ */ -/*=*/ /***en See the documentation of the variable #Mvideomode. */ @@ -1197,14 +1196,14 @@ MSymbol Mreverse; @brief Normal video face. The variable #mface_normal_video points to a face that has the - #Mvideomode property with value #Mnormal. The other properties + #Mvideomode property with value @b Mnormal. The other properties are not specified. An M-text drawn with this face appear normal colors (i.e. the foreground is drawn by foreground color, and background is drawn by background color). */ /***ja @brief ɸ½à¥Ó¥Ç¥ª¥Õ¥§¡¼¥¹. - ÊÑ¿ô #mface_normal_video ¤Ï #Mvideomode ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ #Mnormal + ÊÑ¿ô #mface_normal_video ¤Ï #Mvideomode ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ @b Mnormal ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£ ¤³¤Î¥Õ¥§¡¼¥¹¤Çɽ¼¨¤µ¤ì¤ëM-text ¤Ïɸ½à¤Î¿§ (¤¹¤Ê¤ï¤ÁÁ°·Ê¤ÏÁ°·Ê¿§¡¢ÇطʤÏÇØ·Ê¿§¡Ë¤ÇÉÁ¤«¤ì¤ë¡£ */ @@ -1215,7 +1214,7 @@ MFace *mface_normal_video; @brief Reverse video face. The variable #mface_reverse_video points to a face that has the - #Mvideomode property with value #Mreverse. The other properties + #Mvideomode property with value @b Mreverse. The other properties are not specified. An M-text drawn with this face appear in reversed colors (i.e. the foreground is drawn by background color, and background is drawn by foreground color). */ @@ -1223,7 +1222,7 @@ MFace *mface_normal_video; @brief ¥ê¥Ð¡¼¥¹¥Ó¥Ç¥ª¥Õ¥§¡¼¥¹. ÊÑ¿ô #mface_reverse_video ¤Ï #Mvideomode ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ - #Mreverse ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£ + @b Mreverse ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£ ¤³¤Î¥Õ¥§¡¼¥¹¤Çɽ¼¨¤µ¤ì¤ëM-text ¤ÏÁ°·Ê¿§¤ÈÇØ·Ê¿§¤¬Æþ¤ìÂؤï¤Ã¤Æ (¤¹¤Ê¤ï¤ÁÁ°·Ê¤ÏÇØ·Ê¿§¡¢ÇطʤÏÁ°·Ê¿§¡ËÉÁ¤«¤ì¤ë¡£ */ diff --git a/src/font-ft.c b/src/font-ft.c index 15bdcbd..b04bbd8 100644 --- a/src/font-ft.c +++ b/src/font-ft.c @@ -1537,6 +1537,7 @@ ft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) ft_rfont->ft_face = ft_face; ft_rfont->charmap_list = charmap_list; MSTRUCT_CALLOC (rfont, MERROR_FONT_FT); + rfont->id = ft_info->font.file; rfont->spec = *font; rfont->spec.type = MFONT_TYPE_REALIZED; rfont->spec.property[MFONT_REGISTRY] = reg; @@ -2095,6 +2096,7 @@ ft_encapsulate (MFrame *frame, MSymbol data_type, void *data) MDEBUG_DUMP (" [FONT-FT] encapsulating ", (char *) ft_face->family_name,); MSTRUCT_CALLOC (rfont, MERROR_FONT_FT); + rfont->id = ft_info->font.file; rfont->font = (MFont *) ft_info; rfont->info = ft_rfont; rfont->fontp = ft_face; @@ -2141,36 +2143,40 @@ ft_close (MRealizedFont *rfont) free (rfont); } -static int -ft_check_otf (MFLTFont *font, MFLTOtfSpec *spec) +static OTF * +get_otf (MFLTFont *font, FT_Face *ft_face) { -#ifdef HAVE_OTF MRealizedFont *rfont = ((MFLTFontForRealized *) font)->rfont; MFontFT *ft_info = (MFontFT *) rfont->font; - OTF *otf; - OTF_Tag *tags; - int i, n, negative; + MRealizedFontFT *ft_rfont = rfont->info; + OTF *otf = ft_info->otf; - if (ft_info->otf == invalid_otf) - goto not_otf; - otf = ft_info->otf; if (! otf) { - MRealizedFontFT *ft_rfont = rfont->info; - #if (LIBOTF_MAJOR_VERSION > 0 || LIBOTF_MINOR_VERSION > 9 || LIBOTF_RELEASE_NUMBER > 4) otf = OTF_open_ft_face (ft_rfont->ft_face); #else otf = OTF_open (MSYMBOL_NAME (ft_info->font.file)); #endif - if (! otf) - { - ft_info->otf = invalid_otf; - goto not_otf; - } + if (! otf || OTF_get_table (otf, "head") < 0) + otf = invalid_otf; ft_info->otf = otf; } + if (ft_face) + *ft_face = ft_rfont->ft_face; + return (otf == invalid_otf ? NULL : otf); +} + +static int +ft_check_otf (MFLTFont *font, MFLTOtfSpec *spec) +{ +#ifdef HAVE_OTF + OTF_Tag *tags; + int i, n, negative; + OTF *otf = get_otf (font, NULL); + if (! otf) + goto not_otf; for (i = 0; i < 2; i++) { if (! spec->features[i]) @@ -2239,13 +2245,11 @@ ft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, { int len = to - from; int i, j, gidx; - MRealizedFont *rfont = ((MFLTFontForRealized *) font)->rfont; - MRealizedFontFT *ft_rfont = rfont->info; - MFontFT *ft_info = (MFontFT *) rfont->font; #ifdef HAVE_OTF MGlyph *in_glyphs = (MGlyph *) (in->glyphs); - MGlyph *out_glyphs = (MGlyph *) (out->glyphs); + MGlyph *out_glyphs = out ? (MGlyph *) (out->glyphs) : NULL; OTF *otf; + FT_Face face; OTF_GlyphString otf_gstring; OTF_Glyph *otfg; char script[5], *langsys = NULL; @@ -2253,33 +2257,9 @@ ft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, if (len == 0) return from; - if (ft_info->otf == invalid_otf) - goto simple_copy; - otf = ft_info->otf; + otf = get_otf (font, &face); if (! otf) - { - MRealizedFontFT *ft_rfont = rfont->info; - -#if (LIBOTF_MAJOR_VERSION > 0 || LIBOTF_MINOR_VERSION > 9 || LIBOTF_RELEASE_NUMBER > 4) - otf = OTF_open_ft_face (ft_rfont->ft_face); -#else - otf = OTF_open (MSYMBOL_NAME (ft_info->font.file)); -#endif - if (! otf) - { - ft_info->otf = invalid_otf; - goto simple_copy; - } - ft_info->otf = otf; - } - - if (OTF_get_table (otf, "head") < 0) - { - OTF_close (otf); - ft_info->otf = invalid_otf; - goto simple_copy; - } - + goto simple_copy; OTF_tag_name (spec->script, script); if (spec->langsys) { @@ -2317,54 +2297,87 @@ ft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * len); for (i = 0; i < len; i++) { - otf_gstring.glyphs[i].c = ((MGlyph *)in->glyphs)[from + i].g.c; + otf_gstring.glyphs[i].c = ((MGlyph *)in->glyphs)[from + i].g.c & 0x11FFFF; otf_gstring.glyphs[i].glyph_id = ((MGlyph *)in->glyphs)[from + i].g.code; } OTF_drive_gdef (otf, &otf_gstring); - gidx = out->used; + gidx = out ? out->used : from; if (gsub_features) { - if (OTF_drive_gsub (otf, &otf_gstring, script, langsys, gsub_features) - < 0) + OTF_Feature *features; + MGlyph *g; + unsigned int tag; + + if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys, + gsub_features) < 0) goto simple_copy; - if (out->allocated < out->used + otf_gstring.used) - return -2; - for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, otfg++) + features = otf->gsub->FeatureList.Feature; + if (out) { - MGlyph *g = out_glyphs + out->used; - int j; - int min_from, max_to; - - *g = in_glyphs[from + otfg->f.index.from]; - min_from = g->g.from, max_to = g->g.to; - g->g.c = 0; - for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) - if (in_glyphs[from + j].g.code == otfg->glyph_id) - { - g->g.c = in_glyphs[from + j].g.c; - break; - } - for (j = otfg->f.index.from + 1; j <= otfg->f.index.to; j++) + if (out->allocated < gidx + otf_gstring.used) + return -2; + for (i = 0, otfg = otf_gstring.glyphs, g = out_glyphs + gidx; + i < otf_gstring.used; i++, otfg++, g++, out->used++) { - if (min_from > in_glyphs[from + j].g.from) - min_from = in_glyphs[from + j].g.from; - if (max_to < in_glyphs[from + j].g.to) - max_to = in_glyphs[from + j].g.to; + int feature_idx = otfg->positioning_type >> 4; + int j; + int min_from, max_to; + + *g = in_glyphs[from + otfg->f.index.from]; + min_from = g->g.from, max_to = g->g.to; + g->g.c = 0; + for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) + if (in_glyphs[from + j].g.code == otfg->glyph_id) + { + g->g.c = in_glyphs[from + j].g.c; + break; + } + if (feature_idx) + { + tag = features[feature_idx - 1].FeatureTag; + tag = PACK_OTF_TAG (tag); + g->g.internal = (g->g.internal & ~0xFFFFFFF) | tag; + } + for (j = otfg->f.index.from + 1; j <= otfg->f.index.to; j++) + { + if (min_from > in_glyphs[from + j].g.from) + min_from = in_glyphs[from + j].g.from; + if (max_to < in_glyphs[from + j].g.to) + max_to = in_glyphs[from + j].g.to; + } + if (g->g.code != otfg->glyph_id) + { + g->g.code = otfg->glyph_id; + g->g.measured = 0; + } + g->g.from = min_from, g->g.to = max_to; } - if (g->g.code != otfg->glyph_id) + } + else + { + for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; + i++, otfg++) { - g->g.code = otfg->glyph_id; - g->g.measured = 0; + int feature_idx = otfg->positioning_type >> 4; + + if (feature_idx) + { + tag = features[feature_idx - 1].FeatureTag; + tag = PACK_OTF_TAG (tag); + for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) + { + g = in_glyphs + (from + j); + g->g.internal = (g->g.internal & ~0xFFFFFFF) | tag; + } + } } - g->g.from = min_from, g->g.to = max_to; - out->used++; } } - else + else if (out) { - if (out->allocated < out->used + len) + if (out->allocated < gidx + len) return -2; for (i = 0; i < len; i++) out_glyphs[out->used++] = in_glyphs[from + i]; @@ -2372,123 +2385,152 @@ ft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, if (gpos_features) { - FT_Face face; - MGlyph *base = NULL, *mark = NULL, *g; - int x_ppem, y_ppem, x_scale, y_scale; + OTF_Feature *features; + MGlyph *g; - if (OTF_drive_gpos (otf, &otf_gstring, script, langsys, gpos_features) - < 0) + if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys, + gpos_features) < 0) return to; - - face = ft_rfont->ft_face; - x_ppem = face->size->metrics.x_ppem; - y_ppem = face->size->metrics.y_ppem; - x_scale = face->size->metrics.x_scale; - y_scale = face->size->metrics.y_scale; - - for (i = 0, otfg = otf_gstring.glyphs, g = out_glyphs + gidx; - i < otf_gstring.used; i++, otfg++, g++) + features = otf->gpos->FeatureList.Feature; + if (out) { - MGlyph *prev; - - if (! otfg->glyph_id) - continue; - switch (otfg->positioning_type) + MGlyph *base = NULL, *mark = NULL; + int x_ppem = face->size->metrics.x_ppem; + int y_ppem = face->size->metrics.y_ppem; + int x_scale = face->size->metrics.x_scale; + int y_scale = face->size->metrics.y_scale; + + for (i = j = 0, otfg = otf_gstring.glyphs, g = out_glyphs + gidx; + i < otf_gstring.used; i++, otfg++) { - case 0: - break; - case 1: /* Single */ - case 2: /* Pair */ - { - int format = otfg->f.f1.format; - - if (format & OTF_XPlacement) - adjustment[i].xoff - = otfg->f.f1.value->XPlacement * x_scale / 0x10000; - if (format & OTF_XPlaDevice) - adjustment[i].xoff - += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem); - if (format & OTF_YPlacement) - adjustment[i].yoff - = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000); - if (format & OTF_YPlaDevice) - adjustment[i].yoff - -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem); - if (format & OTF_XAdvance) - adjustment[i].xadv - += otfg->f.f1.value->XAdvance * x_scale / 0x10000; - if (format & OTF_XAdvDevice) - adjustment[i].xadv - += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem); - if (format & OTF_YAdvance) - adjustment[i].yadv - += otfg->f.f1.value->YAdvance * y_scale / 0x10000; - if (format & OTF_YAdvDevice) - adjustment[i].yadv - += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem); - adjustment[i].set = 1; - } - break; - case 3: /* Cursive */ - /* Not yet supported. */ - break; - case 4: /* Mark-to-Base */ - case 5: /* Mark-to-Ligature */ - if (! base) - break; - prev = base; - goto label_adjust_anchor; - default: /* i.e. case 6 Mark-to-Mark */ - if (! mark) - break; - prev = mark; + MGlyph *prev; + int adjust_idx = otfg->glyph_id ? j : j - 1; + int feature_idx = otfg->positioning_type >> 4; - label_adjust_anchor: - { - int base_x, base_y, mark_x, mark_y; - int this_from, this_to; - - base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000; - base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000; - mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000; - mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000;; - - if (otfg->f.f4.base_anchor->AnchorFormat != 1) - adjust_anchor (otfg->f.f4.base_anchor, face, prev->g.code, - x_ppem, y_ppem, &base_x, &base_y); - if (otfg->f.f4.mark_anchor->AnchorFormat != 1) - adjust_anchor (otfg->f.f4.mark_anchor, face, g->g.code, - x_ppem, y_ppem, &mark_x, &mark_y); - adjustment[i].xoff = (base_x - mark_x); - adjustment[i].yoff = - (base_y - mark_y); - adjustment[i].back = (g - prev); - adjustment[i].xadv = 0; - adjustment[i].advance_is_absolute = 1; - adjustment[i].set = 1; - this_from = g->g.from; - this_to = g->g.to; - for (j = 0; prev + j < g; j++) + if (feature_idx) + g->g.internal = ((g->g.internal & ~0xFFFF) + | features[feature_idx - 1].FeatureTag); + + switch (otfg->positioning_type & 0xF) + { + case 0: + break; + case 1: /* Single */ + case 2: /* Pair */ { - if (this_from > prev[j].g.from) - this_from = prev[j].g.from; - if (this_to < prev[j].g.to) - this_to = prev[j].g.to; + int format = otfg->f.f1.format; + + if (format & OTF_XPlacement) + adjustment[adjust_idx].xoff + += otfg->f.f1.value->XPlacement * x_scale / 0x10000; + if (format & OTF_XPlaDevice) + adjustment[adjust_idx].xoff + += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem); + if (format & OTF_YPlacement) + adjustment[adjust_idx].yoff + -= otfg->f.f1.value->YPlacement * y_scale / 0x10000; + if (format & OTF_YPlaDevice) + adjustment[adjust_idx].yoff + -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem); + if (format & OTF_XAdvance) + adjustment[adjust_idx].xadv + += otfg->f.f1.value->XAdvance * x_scale / 0x10000; + if (format & OTF_XAdvDevice) + adjustment[adjust_idx].xadv + += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem); + if (format & OTF_YAdvance) + adjustment[adjust_idx].yadv + += otfg->f.f1.value->YAdvance * y_scale / 0x10000; + if (format & OTF_YAdvDevice) + adjustment[adjust_idx].yadv + += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem); + adjustment[adjust_idx].set = 1; } - for (; prev <= g; prev++) + break; + case 3: /* Cursive */ + /* Not yet supported. */ + break; + case 4: /* Mark-to-Base */ + case 5: /* Mark-to-Ligature */ + if (! base) + break; + prev = base; + goto label_adjust_anchor; + default: /* i.e. case 6 Mark-to-Mark */ + if (! mark) + break; + prev = mark; + + label_adjust_anchor: { - prev->g.from = this_from; - prev->g.to = this_to; + int base_x, base_y, mark_x, mark_y; + int this_from, this_to; + int k; + + base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000; + base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000; + mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000; + mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000;; + + if (otfg->f.f4.base_anchor->AnchorFormat != 1) + adjust_anchor (otfg->f.f4.base_anchor, face, prev->g.code, + x_ppem, y_ppem, &base_x, &base_y); + if (otfg->f.f4.mark_anchor->AnchorFormat != 1) + adjust_anchor (otfg->f.f4.mark_anchor, face, g->g.code, + x_ppem, y_ppem, &mark_x, &mark_y); + adjustment[adjust_idx].xoff = base_x - mark_x; + adjustment[adjust_idx].yoff = - (base_y - mark_y); + adjustment[adjust_idx].back = (g - prev); + adjustment[adjust_idx].xadv = 0; + adjustment[adjust_idx].advance_is_absolute = 1; + adjustment[adjust_idx].set = 1; + this_from = g->g.from; + this_to = g->g.to; + for (k = 0; prev + k < g; k++) + { + if (this_from > prev[k].g.from) + this_from = prev[k].g.from; + if (this_to < prev[k].g.to) + this_to = prev[k].g.to; + } + for (; prev <= g; prev++) + { + prev->g.from = this_from; + prev->g.to = this_to; + } } - } + } + if (otfg->glyph_id) + { + if (otfg->GlyphClass == OTF_GlyphClass0) + base = mark = g; + else if (otfg->GlyphClass == OTF_GlyphClassMark) + mark = g; + else + base = g; + j++, g++; + } } - if (otfg->GlyphClass == OTF_GlyphClass0) - base = mark = g; - else if (otfg->GlyphClass == OTF_GlyphClassMark) - mark = g; - else - base = g; + } + else + { + for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; + i++, otfg++) + if (otfg->positioning_type & 0xF) + { + int feature_idx = otfg->positioning_type >> 4; + + if (feature_idx) + for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) + { + g = in_glyphs + (from + j); + g->g.internal = ((g->g.internal & ~0xFFFF) + | features[feature_idx - 1].FeatureTag); + } + } } } + free (otf_gstring.glyphs); return to; @@ -2496,22 +2538,123 @@ ft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, if (otf_gstring.glyphs) free (otf_gstring.glyphs); #endif /* HAVE_OTF */ - if (out->allocated < out->used + len) - return -2; - font->get_metrics (font, in, from, to); - memcpy ((MGlyph *)out->glyphs + out->used, (MGlyph *) in->glyphs + from, - sizeof (MGlyph) * len); - out->used += len; + if ( out) + { + if (out->allocated < out->used + len) + return -2; + font->get_metrics (font, in, from, to); + memcpy ((MGlyph *)out->glyphs + out->used, (MGlyph *) in->glyphs + from, + sizeof (MGlyph) * len); + out->used += len; + } return to; } +static int +ft_try_otf (MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *in, int from, int to) +{ + return ft_drive_otf (font, spec, in, from, to, NULL, NULL); +} + + +#ifdef HAVE_OTF +static unsigned char *iterate_bitmap; + +static int +iterate_callback (OTF *otf, const char *feature, unsigned glyph_id) +{ + if (glyph_id <= otf->cmap->max_glyph_id) + iterate_bitmap[glyph_id / 8] |= 1 << (glyph_id % 8); + return 0; +} + +static int +ft_iterate_otf_feature (MFLTFont *font, MFLTOtfSpec *spec, + int from, int to, unsigned char *table) +{ + OTF *otf = get_otf (font, NULL); + char id[13]; + int bmp_size; + unsigned char *bitmap = NULL; + int i, j; + char script[5], *langsys = NULL; + + if (! otf) + return -1; + if (OTF_get_table (otf, "cmap") < 0) + return -1; + if (! spec->features[0]) + return -1; + strcpy (id, "feature-"); + id[12] = '\0'; + OTF_tag_name (spec->script, script); + if (spec->langsys) + { + langsys = alloca (5); + OTF_tag_name (spec->langsys, langsys); + } + bmp_size = (otf->cmap->max_glyph_id / 8) + 1; + for (i = 0; spec->features[0][i]; i++) + { + unsigned char *bmp; + + OTF_tag_name (spec->features[0][i], id + 8); + bmp = OTF_get_data (otf, id); + if (! bmp) + { + iterate_bitmap = bmp = calloc (bmp_size, 1); + OTF_iterate_gsub_feature (otf, iterate_callback, + script, langsys, id + 8); + OTF_put_data (otf, id, bmp, free); + } + if (i == 0 && ! spec->features[0][1]) + /* Single feature */ + bitmap = bmp; + else + { + if (! bitmap) + { + bitmap = alloca (bmp_size); + memcpy (bitmap, bmp, bmp_size); + } + else + { + int j; + + for (j = 0; j < bmp_size; j++) + bitmap[j] &= bmp[j]; + } + } + } + for (i = 0; i < bmp_size; i++) + if (bitmap[i]) + { + for (j = 0; j < 8; j++) + if (bitmap[i] & (1 << j)) + { + int c = OTF_get_unicode (otf, (i * 8) + j); + + if (c >= from && c <= to) + table[c - from] = 1; + } + } + return 0; +} +#endif + + /* Internal API */ MFontDriver mfont__ft_driver = { ft_select, ft_open, ft_find_metric, ft_has_char, ft_encode_char, ft_render, ft_list, ft_list_family_names, ft_check_capability, - ft_encapsulate, ft_close, ft_check_otf, ft_drive_otf }; + ft_encapsulate, ft_close, ft_check_otf, ft_drive_otf, ft_try_otf, +#ifdef HAVE_OTF + ft_iterate_otf_feature +#endif /* HAVE_OTF */ + }; int mfont__ft_init () diff --git a/src/font.c b/src/font.c index e808593..ecd8c6b 100644 --- a/src/font.c +++ b/src/font.c @@ -1685,13 +1685,16 @@ mfont__get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring, if (g->g.encoded) continue; - if (! encoding->encoding_charset) - g->g.code = MCHAR_INVALID_CODE; - else if (mfont->source == MFONT_SOURCE_X && encoding->repertory_charset) - g->g.code = ENCODE_CHAR (encoding->repertory_charset, g->g.code); + if (mfont->source == MFONT_SOURCE_X && encoding->repertory_charset) + g->g.code = ENCODE_CHAR (encoding->repertory_charset, g->g.c); else { - unsigned code = ENCODE_CHAR (encoding->encoding_charset, g->g.code); + unsigned code; + + if (encoding->encoding_charset) + code = ENCODE_CHAR (encoding->encoding_charset, g->g.c); + else + code = g->g.code; if (code != MCHAR_INVALID_CODE) { @@ -1708,9 +1711,8 @@ mfont__get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring, MFATAL (MERROR_FONT); } } - g->g.code - = (driver->encode_char) (rfont->frame, rfont->font, mfont, - g->g.code); + g->g.code = (driver->encode_char) (rfont->frame, rfont->font, + mfont, code); } } g->g.encoded = 1; @@ -1956,7 +1958,7 @@ mfont__check_capability (MRealizedFont *rfont, MSymbol capability) /***ja @brief ³«È¯¸µ¤ò»ØÄꤹ¤ë¥Õ¥©¥ó¥È¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼. - ÊÑ¿ô #Mfoundry ¤Ï "fonudry" + ÊÑ¿ô #Mfoundry ¤Ï "foundry" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ê¡¢¥Õ¥©¥ó¥È¥×¥í¥Ñ¥Æ¥£¤È¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ Ãͤϡ¢¥Õ¥©¥ó¥È¤Î³«È¯¸µÌ¾¤ò̾Á°¤È¤·¤Æ»ý¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£ */ @@ -2158,42 +2160,42 @@ MSymbol Mfontconfig; /***en @brief Symbol of name "x". - The variable #Mx is to be used for a value of member of the - structure #MDrawGlyph to specify the type of member is + The variable #Mx is to be used for a value of \ member of the + structure #MDrawGlyph to specify the type of \ member is actually (XFontStruct *). */ /***ja @brief "x" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. - ÊÑ¿ô #Mx ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð - ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XFontStruct *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹. */ + ÊÑ¿ô #Mx ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð \ + ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð \ ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XFontStruct *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹. */ MSymbol Mx; /***en @brief Symbol of name "freetype". - The variable #Mfreetype is to be used for a value of member - of the structure #MDrawGlyph to specify the type of member + The variable #Mfreetype is to be used for a value of \ member + of the structure #MDrawGlyph to specify the type of \ member is actually FT_Face. */ /***ja @brief "freetype" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. - ÊÑ¿ô #Mfreetype ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð - ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï FT_Face ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£ */ + ÊÑ¿ô #Mfreetype ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð \ + ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð \ ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï FT_Face ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£ */ MSymbol Mfreetype; /***en @brief Symbol of name "xft". - The variable #Mxft is to be used for a value of member of the - structure #MDrawGlyph to specify the type of member + The variable #Mxft is to be used for a value of \ member of the + structure #MDrawGlyph to specify the type of \ member is actually (XftFont *). */ /***ja @brief "xft" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. - ÊÑ¿ô #Mxft ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð - ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XftFont *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£ */ + ÊÑ¿ô #Mxft ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð \ + ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð \ ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XftFont *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£ */ MSymbol Mxft; @@ -2395,14 +2397,14 @@ mfont_copy (MFont *font) If $FONT is a return value of mfont_find (), $KEY can also be one of the following symbols: - #Mfont_ascent, #Mfont_descent, #Mmax_advance. + @b Mfont_ascent, @b Mfont_descent, #Mmax_advance. @return If $KEY is @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, @c Madstyle, @c Mregistry, or @c Mspacing, this function returns the corresponding value as a symbol. If the font does not have $KEY property, it returns @c Mnil. If $KEY is @c - Msize, @c Mresolution, #Mfont_ascent, Mfont_descent, or + Msize, @c Mresolution, @b Mfont_ascent, Mfont_descent, or #Mmax_advance, this function returns the corresponding value as an integer. If the font does not have $KEY property, it returns 0. If $KEY is something else, it returns @c NULL and assigns an error @@ -3113,7 +3115,7 @@ mfont_open (MFrame *frame, MFont *font) @brief Encapusulate a font. The mfont_encapsulate () functions realizes a font by - encapusulating data $DATA or type $DATA_TYPE on #FRAME. Currently + encapusulating data $DATA or type $DATA_TYPE on $FRAME. Currently $DATA_TAPE is #Mfontconfig or #Mfreetype, and $DATA points to an object of FcPattern or FT_Face respectively. diff --git a/src/font.h b/src/font.h index 4d4318f..aaa6c2f 100644 --- a/src/font.h +++ b/src/font.h @@ -140,6 +140,9 @@ struct MRealizedFont so that this object can be distingushed from MFont. */ MFont spec; + /* Font identifier. */ + MSymbol id; + /* Frame on which the font is realized. */ MFrame *frame; @@ -240,6 +243,12 @@ struct MFontDriver int (*drive_otf) (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, int from, int to, MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment); + + int (*try_otf) (MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *in, int from, int to); + + int (*iterate_otf_feature) (struct _MFLTFont *font, MFLTOtfSpec *spec, + int from, int to, unsigned char *table); }; /** Initialize the members of FONT. */ diff --git a/src/fontset.c b/src/fontset.c index 7a431f3..adb21d5 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -74,6 +74,8 @@ #include "font.h" #include "fontset.h" +static int mdebug_flag = MDEBUG_FONTSET; + static M17NObjectArray fontset_table; struct MFontset @@ -750,6 +752,17 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, MPlist *plist; MRealizedFont *rfont = NULL; + if (MDEBUG_FLAG ()) + { + int i; + + MDEBUG_PRINT1 (" [FONTSET] fontset looking up for %s:", + script ? script->name : "none"); + for (i = 0; i < *num; i++) + MDEBUG_PRINT1 (" U+%04X", g[i].g.c); + MDEBUG_PRINT ("\n"); + } + if (realized->tick != realized->fontset->tick) update_fontset_elements (realized); @@ -757,7 +770,7 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, && (per_charset = mplist_get (realized->per_charset, charset)) != NULL && (rfont = try_font_group (realized, &realized->request, per_charset, g, num, size))) - return rfont; + goto done; if (script != Mnil) { @@ -786,7 +799,7 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, if ((per_lang = mplist_get (per_script, language)) && (rfont = try_font_group (realized, &request, per_lang, g, num, size))) - return rfont; + goto done; if (per_lang && *num > 1) *num = 1; @@ -798,7 +811,7 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, && (rfont = try_font_group (realized, &request, MPLIST_PLIST (plist), g, num, size))) - return rfont; + goto done; } else { @@ -806,7 +819,7 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, if ((per_lang = mplist_get (per_script, Mt)) && (rfont = try_font_group (realized, &request, per_lang, g, num, size))) - return rfont; + goto done; if (per_lang && *num > 1) *num = 1; @@ -817,10 +830,10 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, && (rfont = try_font_group (realized, &request, MPLIST_PLIST (plist), g, num, size))) - return rfont; + goto done; } if (ignore_fallback) - return NULL; + goto done; } if (language != Mnil) @@ -836,30 +849,25 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, if ((per_lang = mplist_get (MPLIST_PLIST (plist), language)) && (rfont = try_font_group (realized, &request, per_lang, g, num, size))) - return rfont; + goto done; } /* Try fallback fonts. */ - if ((rfont = try_font_group (realized, &realized->request, - realized->fallback, g, num, size))) - return rfont; - - return NULL; - - /* At last try all fonts. */ - MPLIST_DO (per_script, realized->per_script) + rfont = try_font_group (realized, &realized->request, + realized->fallback, g, num, size); + done: + if (MDEBUG_FLAG ()) { - MPLIST_DO (per_lang, MPLIST_PLIST (per_script)) - if ((rfont = try_font_group (realized, &realized->request, - MPLIST_PLIST (per_lang), g, num, size))) - return rfont; + if (rfont) + { + MSymbol family = mfont_get_prop (rfont->font, Mfamily); + MDEBUG_PRINT1 (" [FONTSET] found %s\n", family->name); + } + else + MDEBUG_PRINT (" [FONTSET] not found\n"); } - MPLIST_DO (per_charset, realized->per_charset) - if ((rfont = try_font_group (realized, &realized->request, - MPLIST_PLIST (per_charset), g, num, size))) - return rfont; - return NULL; + return rfont; } MRealizedFont * @@ -1180,7 +1188,7 @@ mfontset_copy (MFontset *fontset, char *name) are removed from the group. If $LAYOUTER_NAME is not @c Mnil, it must be a symbol representing - a @ref flt (font layout table). In that case, if $FONT is + a @ref mdbFLT (font layout table). In that case, if $FONT is selected for drawing an M-text, that font layout table is used to generate a glyph code sequence from a character sequence. @@ -1217,7 +1225,7 @@ mfontset_copy (MFontset *fontset, char *name) ¤¬Éé¤Ê¤é¤Ð¡¢ºÇÄã¤ÎÍ¥ÀèÅÙ¤ò»ý¤Ä¡£$HOW ¤¬ 0 ¤Ê¤é¤Ð¡¢$FONT ¤Ï´ØÏ¢ÉÕ¤±¤é¤ì¤¿¤â¤Î¤ËÂФ¹¤ëÍ£°ì¤ÎÍøÍѲÄǽ¤Ê¥Õ¥©¥ó¥È¤È¤Ê¤ê¡¢Â¾¤Î¥Õ¥©¥ó¥È¤Ï¥°¥ë¡¼¥×¤«¤é¼è¤ê½ü¤«¤ì¤ë¡£ - $LAYOUTER_NAME ¤Ï @c Mnil ¤Ç¤¢¤ë¤«¡¢@ref flt + $LAYOUTER_NAME ¤Ï @c Mnil ¤Ç¤¢¤ë¤«¡¢@ref mdbFLT ¡Ê¥Õ¥©¥ó¥È¥ì¥¤¥¢¥¦¥È¥Æ¡¼¥Ö¥ë¡Ë¤ò¼¨¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£¥·¥ó¥Ü¥ë¤Ç¤¢¤ì¤Ð¡¢$FONT ¤òÍѤ¤¤Æ M-text ¤òɽ¼¨¤¹¤ëºÝ¤Ë¤Ï¡¢¤½¤Î¥Õ¥©¥ó¥È¥ì¥¤¥¢¥¦¥È¥Æ¡¼¥Ö¥ë¤ò»È¤Ã¤Æʸ»úÎ󤫤饰¥ê¥Õ¥³¡¼¥ÉÎó¤òÀ¸À®¤¹¤ë¡£ diff --git a/src/input.c b/src/input.c index 5123eac..0e3b9a7 100644 --- a/src/input.c +++ b/src/input.c @@ -50,19 +50,19 @@ input event to an input key by himself. See the documentation of the function minput_event_to_key () for the detail. -
    • Foreign Input Method +
    • Foreign Input Method @anchor foreign-input-method A foreign input method has @c Mnil LANGUAGE, and its body is defined in an external resource (e.g. XIM of X Window System). For this kind of input methods, the symbol NAME must have a - property of key @c Minput_driver, and the value must be a pointer + property of key #Minput_driver, and the value must be a pointer to an input method driver. Therefore, by preparing a proper driver, any kind of input method can be treated in the framework of the @c m17n @c library. For convenience, the m17n-X library provides an input method driver that enables the input style of OverTheSpot for XIM, and - stores @c Minput_driver property of the symbol @c Mxim with a + stores #Minput_driver property of the symbol @c Mxim with a pointer to the driver. See the documentation of m17n GUI API for the detail. @@ -106,11 +106,11 @@ ¹Ô¤ï¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï´Ø¿ô minput_event_to_key () ¤Î ÀâÌÀ¤ò»²¾È¡£ -
    • ³°ÉôÆþÎϥ᥽¥Ã¥É +
    • ³°ÉôÆþÎϥ᥽¥Ã¥É @anchor foreign-input-method ³°ÉôÆþÎϥ᥽¥Ã¥É¤È¤Ï LANGUAGE ¤¬ @c Mnil ¤Î¤â¤Î¤Ç¤¢¤ê¡¢¤½¤ÎËÜÂΤϳ° Éô¤Î¥ê¥½¡¼¥¹¤È¤·¤ÆÄêµÁ¤µ¤ì¤ë¡£¡Ê¤¿¤È¤¨¤ÐX Window System ¤ÎXIM ¤Ê - ¤É¡£) ¤³¤Î¼ï¤ÎÆþÎϥ᥽¥Ã¥É¤Ç¤Ï¡¢¥·¥ó¥Ü¥ë NAME ¤Ï@c Minput_driver ¤ò + ¤É¡£) ¤³¤Î¼ï¤ÎÆþÎϥ᥽¥Ã¥É¤Ç¤Ï¡¢¥·¥ó¥Ü¥ë NAME ¤Ï #Minput_driver ¤ò ¥­¡¼¤È¤¹¤ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Á¡¢¤½¤ÎÃͤÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó ¥¿¤Ç¤¢¤ë¡£¤³¤Î¤³¤È¤Ë¤è¤ê¡¢Å¬Àڤʥɥ饤¥Ð¤ò½àÈ÷¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢¤¤ ¤«¤Ê¤ë¼ïÎà¤ÎÆþÎϥ᥽¥Ã¥É¤â@c m17n @c ¥é¥¤¥Ö¥é¥ê ¤ÎÏÈÁȤÎÃæ¤Ç°·¤¦»ö @@ -118,7 +118,7 @@ ÍøÊØÀ­¤Î´ÑÅÀ¤«¤é¡¢m17n X ¥é¥¤¥Ö¥é¥ê¤Ï XIM ¤Î OverTheSpot ¤ÎÆþÎÏ¥¹¥¿ ¥¤¥ë¤ò¼Â¸½¤¹¤ëÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤òÄ󶡤·¡¢¤Þ¤¿¥·¥ó¥Ü¥ë @c Mxim ¤Î - @c Minput_driver ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ¤½¤Î¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÝ»ý + #Minput_driver ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ¤½¤Î¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÝ»ý ¤·¤Æ¤¤¤ë¡£¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï m17n GUI API ¤Î¥É¥­¥å¥á¥ó¥È¤ò»²¾È¤Î¤³¤È¡£
    @@ -167,8 +167,6 @@ static int mdebug_flag = MDEBUG_INPUT; static int fully_initialized; -static MSymbol Minput_method; - /** Symbols to load an input method data. */ static MSymbol Mtitle, Mmacro, Mmodule, Mstate, Minclude; @@ -545,7 +543,8 @@ marker_code (MSymbol sym, int surrounding) } -/* Return a plist containing an integer value of VAR. */ +/* Return a plist containing an integer value of VAR. The plist must + not be UNREFed. */ static MPlist * resolve_variable (MInputContextInfo *ic_info, MSymbol var) @@ -668,7 +667,7 @@ get_following_char (MInputContext *ic, int pos) } static int -surrounding_pos (MSymbol sym) +surrounding_pos (MSymbol sym, int *pos) { char *name; @@ -676,9 +675,13 @@ surrounding_pos (MSymbol sym) return 0; name = MSYMBOL_NAME (sym); if (name[0] == '@' - && (name[1] == '-' || name[1] == '+') - && name[2] >= '1' && name[2] <= '9') - return (name[1] == '-' ? - atoi (name + 2) : atoi (name + 2)); + && (name[1] == '-' ? (name[2] >= '1' && name[2] <= '9') + : name[1] == '+' ? (name[2] >= '0' && name[2] <= '9') + : 0)) + { + *pos = name[1] == '-' ? - atoi (name + 2) : atoi (name + 2); + return 1; + } return 0; } @@ -709,12 +712,9 @@ integer_value (MInputContext *ic, MPlist *arg, int surrounding) if (name[2]) { pos = atoi (name + 1); - if (pos == 0) + if (pos == 0 && code == '-') return get_preceding_char (ic, 0); - if (pos < 0) - pos = ic->cursor_pos + pos; - else - pos = ic->cursor_pos + pos - 1; + pos = ic->cursor_pos + pos; if (pos < 0) { if (ic->produced && mtext_len (ic->produced) + pos >= 0) @@ -1230,9 +1230,11 @@ load_external_module (MInputMethodInfo *im_info, MPlist *plist) module = msymbol ((char *) MTEXT_DATA (MPLIST_MTEXT (plist))); else if (MPLIST_SYMBOL_P (plist)) module = MPLIST_SYMBOL (plist); - module_file = alloca (strlen (MSYMBOL_NAME (module)) + module_file = alloca (strlen (M17N_MODULE_DIR) + 1 + + strlen (MSYMBOL_NAME (module)) + strlen (DLOPEN_SHLIB_EXT) + 1); - sprintf (module_file, "%s%s", MSYMBOL_NAME (module), DLOPEN_SHLIB_EXT); + sprintf (module_file, "%s/%s%s", + M17N_MODULE_DIR, MSYMBOL_NAME (module), DLOPEN_SHLIB_EXT); handle = dlopen (module_file, RTLD_NOW); if (MFAILP (handle)) @@ -2743,6 +2745,8 @@ get_select_charset (MInputContextInfo * ic_info) return MCHARSET (sym); } +/* The returned plist must be UNREFed. */ + static MPlist * adjust_candidates (MPlist *plist, MCharset *charset) { @@ -2845,6 +2849,8 @@ adjust_candidates (MPlist *plist, MCharset *charset) return plist; } +/* The returned Plist must be UNREFed. */ + static MPlist * get_candidate_list (MInputContextInfo *ic_info, MPlist *args) { @@ -2857,83 +2863,90 @@ get_candidate_list (MInputContextInfo *ic_info, MPlist *args) column = MPLIST_INTEGER (plist); plist = MPLIST_PLIST (args); + if (! plist) + return NULL; if (charset) - plist = adjust_candidates (plist, charset); + { + plist = adjust_candidates (plist, charset); + if (! plist) + return NULL; + } + else + M17N_OBJECT_REF (plist); - if (plist && column > 0) + if (column == 0) + return plist; + + if (MPLIST_MTEXT_P (plist)) { - if (MPLIST_MTEXT_P (plist)) - { - MText *mt = MPLIST_MTEXT (plist); - MPlist *next = MPLIST_NEXT (plist); + MText *mt = MPLIST_MTEXT (plist); + MPlist *next = MPLIST_NEXT (plist); - if (MPLIST_TAIL_P (next)) - M17N_OBJECT_REF (mt); - else + if (MPLIST_TAIL_P (next)) + M17N_OBJECT_REF (mt); + else + { + mt = mtext_dup (mt); + while (! MPLIST_TAIL_P (next)) { - mt = mtext_dup (mt); - while (! MPLIST_TAIL_P (next)) - { - mt = mtext_cat (mt, MPLIST_MTEXT (next)); - next = MPLIST_NEXT (next); - } + mt = mtext_cat (mt, MPLIST_MTEXT (next)); + next = MPLIST_NEXT (next); } - if (charset) - M17N_OBJECT_UNREF (plist); - plist = mplist (); - len = mtext_nchars (mt); - if (len <= column) - mplist_add (plist, Mtext, mt); - else + } + M17N_OBJECT_UNREF (plist); + plist = mplist (); + len = mtext_nchars (mt); + if (len <= column) + mplist_add (plist, Mtext, mt); + else + { + for (i = 0; i < len; i += column) { - for (i = 0; i < len; i += column) - { - int to = (i + column < len ? i + column : len); - MText *sub = mtext_copy (mtext (), 0, mt, i, to); + int to = (i + column < len ? i + column : len); + MText *sub = mtext_copy (mtext (), 0, mt, i, to); - mplist_add (plist, Mtext, sub); - M17N_OBJECT_UNREF (sub); - } + mplist_add (plist, Mtext, sub); + M17N_OBJECT_UNREF (sub); } - M17N_OBJECT_UNREF (mt); } - else if (! MPLIST_TAIL_P (plist)) + M17N_OBJECT_UNREF (mt); + } + else if (MPLIST_PLIST_P (plist)) + { + MPlist *tail = plist; + MPlist *new = mplist (); + MPlist *this = mplist (); + int count = 0; + + MPLIST_DO (tail, tail) { - MPlist *tail = plist; - MPlist *new = mplist (); - MPlist *this = mplist (); - int count = 0; + MPlist *p = MPLIST_PLIST (tail); - MPLIST_DO (tail, tail) + MPLIST_DO (p, p) { - MPlist *p = MPLIST_PLIST (tail); + MText *mt = MPLIST_MTEXT (p); - MPLIST_DO (p, p) + if (count == column) { - MText *mt = MPLIST_MTEXT (p); - - if (count == column) - { - mplist_add (new, Mplist, this); - M17N_OBJECT_UNREF (this); - this = mplist (); - count = 0; - } - mplist_add (this, Mtext, mt); - count++; + mplist_add (new, Mplist, this); + M17N_OBJECT_UNREF (this); + this = mplist (); + count = 0; } + mplist_add (this, Mtext, mt); + count++; } - mplist_add (new, Mplist, this); - M17N_OBJECT_UNREF (this); - mplist_set (plist, Mnil, NULL); - MPLIST_DO (tail, new) - { - MPlist *elt = MPLIST_PLIST (tail); + } + mplist_add (new, Mplist, this); + M17N_OBJECT_UNREF (this); + mplist_set (plist, Mnil, NULL); + MPLIST_DO (tail, new) + { + MPlist *elt = MPLIST_PLIST (tail); - mplist_add (plist, Mplist, elt); - } - M17N_OBJECT_UNREF (new); + mplist_add (plist, Mplist, elt); } + M17N_OBJECT_UNREF (new); } return plist; @@ -3033,18 +3046,22 @@ take_action_list (MInputContext *ic, MPlist *action_list) else if (name == M_candidates) { MPlist *plist = get_candidate_list (ic_info, args); + MPlist *pl; int len; - if (! plist || (MPLIST_PLIST_P (plist) && MPLIST_TAIL_P (plist))) + if (! plist) continue; + if (MPLIST_PLIST_P (plist) && MPLIST_TAIL_P (plist)) + { + M17N_OBJECT_UNREF (plist); + continue; + } if (MPLIST_MTEXT_P (plist)) { preedit_insert (ic, ic->cursor_pos, NULL, mtext_ref_char (MPLIST_MTEXT (plist), 0)); len = 1; } - else if (MPLIST_TAIL_P (MPLIST_PLIST (plist))) - continue; else { MText * mt = MPLIST_MTEXT (MPLIST_PLIST (plist)); @@ -3052,11 +3069,12 @@ take_action_list (MInputContext *ic, MPlist *action_list) preedit_insert (ic, ic->cursor_pos, mt, 0); len = mtext_nchars (mt); } - plist = mplist_copy (plist); + pl = mplist_copy (plist); + M17N_OBJECT_UNREF (plist); mtext_put_prop (ic->preedit, ic->cursor_pos - len, ic->cursor_pos, - Mcandidate_list, plist); - M17N_OBJECT_UNREF (plist); + Mcandidate_list, pl); + M17N_OBJECT_UNREF (pl); mtext_put_prop (ic->preedit, ic->cursor_pos - len, ic->cursor_pos, Mcandidate_index, (void *) 0); @@ -3156,7 +3174,7 @@ take_action_list (MInputContext *ic, MPlist *action_list) int to; if (MPLIST_SYMBOL_P (args) - && (pos = surrounding_pos (MPLIST_SYMBOL (args))) != 0) + && surrounding_pos (MPLIST_SYMBOL (args), &pos)) { to = ic->cursor_pos + pos; if (to < 0) @@ -4127,8 +4145,19 @@ minput__char_to_key (int c) /*=*/ /***en - @name Variables: Predefined symbols for callback commands. + @brief Symbol whose name is "input-method". + */ +/***ja + @brief "input-method" ¤ò̾Á°¤È¤·¤Æ»ý¤Ä¥·¥ó¥Ü¥ë. + */ +MSymbol Minput_method; +/***en + @name Variables: Predefined symbols for callback commands. */ +/***ja + @name ÊÑ¿ô¡§ ¥³¡¼¥ë¥Ð¥Ã¥¯¥³¥Þ¥ó¥ÉÍÑÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë. */ +/*** @{ */ +/***en These are the predefined symbols that are used as the @c COMMAND argument of callback functions of an input method driver (see #MInputDriver::callback_list). @@ -4136,7 +4165,7 @@ minput__char_to_key (int c) Most of them do not require extra argument nor return any value; exceptions are these: - Minput_get_surrounding_text: When a callback function assigned for + @b Minput_get_surrounding_text: When a callback function assigned for this command is called, the first element of #MInputContext::plist has key #Minteger and the value specifies which portion of the surrounding text should be retrieved. If the value is positive, @@ -4158,7 +4187,7 @@ minput__char_to_key (int c) function should return without changing the first element of #MInputContext::plist. - Minput_delete_surrounding_text: When a callback function assigned + @b Minput_delete_surrounding_text: When a callback function assigned for this command is called, the first element of #MInputContext::plist has key #Minteger and the value specifies which portion of the surrounding text should be deleted in the @@ -4166,8 +4195,6 @@ minput__char_to_key (int c) function must delete the specified text. It should not alter #MInputContext::plist. */ /***ja - @name ÊÑ¿ô¡§ ¥³¡¼¥ë¥Ð¥Ã¥¯¥³¥Þ¥ó¥ÉÍÑÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë. - ÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Î¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Ë¤ª¤¤¤Æ @c COMMAND °ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¤ëÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë (#MInputDriver::callback_list »²¾È)¡£ @@ -4196,9 +4223,6 @@ minput__char_to_key (int c) Minput_get_surrounding_text ¤ÈƱÍͤΤä¤êÊý¤Ç»ØÄꤹ¤ë¡£¥³¡¼¥ë¥Ð¥Ã¥¯ ´Ø¿ô¤Ï»ØÄꤵ¤ì¤¿¥Æ¥­¥¹¥È¤òºï½ü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤Þ¤¿ #MInputContext::plist ¤òÊѤ¨¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */ -/*** @{ */ -/*=*/ - MSymbol Minput_preedit_start; MSymbol Minput_preedit_done; MSymbol Minput_preedit_draw; @@ -4238,18 +4262,18 @@ MSymbol Minput_focus_move; /*=*/ /***en - @name Variables: Predefined symbols used in input method information. - + @name Variables: Predefined symbols used in input method information. */ +/***ja + @name ÊÑ¿ô: ÆþÎϥ᥽¥Ã¥É¾ðÊóÍÑÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë. */ +/*** @{ */ +/*=*/ +/***en These are the predefined symbols describing status of input method command and variable, and are used in a return value of minput_get_command () and minput_get_variable (). */ /***ja - @name ÊÑ¿ô: ÆþÎϥ᥽¥Ã¥É¾ðÊóÍÑÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë. - ÆþÎϥ᥽¥Ã¥É¤Î¥³¥Þ¥ó¥É¤äÊÑ¿ô¤Î¾õÂÖ¤òɽ¤·¡¢minput_get_command () ¤È minput_get_variable () ¤ÎÌá¤êÃͤȤ·¤ÆÍѤ¤¤é¤ì¤ëÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë¡£ */ -/*** @{ */ -/*=*/ MSymbol Minherited; MSymbol Mcustomized; MSymbol Mconfigured; @@ -4318,6 +4342,10 @@ MInputDriver minput_default_driver; MInputDriver *minput_driver; +/*=*/ +/*** + The variable #Minput_driver is a symbol for a foreign input method. + See @ref foreign-input-method "foreign input method" for the detail. */ MSymbol Minput_driver; /*=*/ @@ -4446,8 +4474,8 @@ minput_close_im (MInputMethod *im) The minput_create_ic () function creates an input context object associated with input method $IM, and calls callback functions - corresponding to #Minput_preedit_start, #Minput_status_start, and - #Minput_status_draw in this order. + corresponding to @b Minput_preedit_start, @b Minput_status_start, and + @b Minput_status_draw in this order. @return If an input context is successfully created, minput_create_ic () @@ -4458,7 +4486,7 @@ minput_close_im (MInputMethod *im) ´Ø¿ô minput_create_ic () ¤ÏÆþÎϥ᥽¥Ã¥É $IM ¤ËÂбþ¤¹¤ëÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¡¢ - #Minput_preedit_start, #Minput_status_start, #Minput_status_draw + @b Minput_preedit_start, @b Minput_status_start, @b Minput_status_draw ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ò¤³¤Î½ç¤Ë¸Æ¤Ö¡£ @return @@ -4510,8 +4538,8 @@ minput_create_ic (MInputMethod *im, void *arg) The minput_destroy_ic () function destroys the input context $IC, which must have been created by minput_create_ic (). It calls - callback functions corresponding to #Minput_preedit_done, - #Minput_status_done, and #Minput_candidates_done in this order. */ + callback functions corresponding to @b Minput_preedit_done, + @b Minput_status_done, and @b Minput_candidates_done in this order. */ /***ja @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÇ˲õ¤¹¤ë. @@ -4519,7 +4547,7 @@ minput_create_ic (MInputMethod *im, void *arg) ´Ø¿ô minput_destroy_ic () ¤Ï¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤òÇ˲õ¤¹¤ë¡£ ¤³¤ÎÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ï minput_create_ic () ¤Ë¤è¤Ã¤Æºî¤é¤ì¤¿¤â¤Î¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤Î´Ø¿ô¤Ï - #Minput_preedit_done, #Minput_status_done, #Minput_candidates_done + @b Minput_preedit_done, @b Minput_status_done, @b Minput_candidates_done ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ò¤³¤Î½ç¤Ë¸Æ¤Ö¡£ */ @@ -4549,8 +4577,8 @@ minput_destroy_ic (MInputContext *ic) The minput_filter () function filters input key $KEY according to input context $IC, and calls callback functions corresponding to - #Minput_preedit_draw, #Minput_status_draw, and - #Minput_candidates_draw if the preedit text, the status, and the + @b Minput_preedit_draw, @b Minput_status_draw, and + @b Minput_candidates_draw if the preedit text, the status, and the current candidate are changed respectively. To make the input method commit the current preedit text (if any) @@ -4558,14 +4586,14 @@ minput_destroy_ic (MInputContext *ic) $KEY. To inform the input method about the focus-out event, call this - function with #Minput_focus_out as $KEY. + function with @b Minput_focus_out as $KEY. To inform the input method about the focus-in event, call this - function with #Minput_focus_in as $KEY. + function with @b Minput_focus_in as $KEY. To inform the input method about the focus-move event (i.e. input spot change within the same input context), call this function - with #Minput_focus_move as $KEY. + with @b Minput_focus_move as $KEY. @return If $KEY is filtered out, this function returns 1. In that case, @@ -4578,8 +4606,8 @@ minput_destroy_ic (MInputContext *ic) ´Ø¿ô minput_filter () ¤ÏÆþÎÏ¥­¡¼ $KEY ¤òÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤Ë±þ¤¸¤Æ¥Õ¥£¥ë¥¿¤·¡¢preedit ¥Æ¥­¥¹¥È¡¢¥¹¥Æ¡¼¥¿¥¹¡¢¸½»þÅÀ¤Ç¤Î¸õÊ䤬ÊѲ½¤·¤¿»þÅÀ¤Ç¡¢¤½¤ì¤¾¤ì - #Minput_preedit_draw, #Minput_status_draw, - #Minput_candidates_draw ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ò¸Æ¤Ö¡£ + @b Minput_preedit_draw, @b Minput_status_draw, + @b Minput_candidates_draw ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ò¸Æ¤Ö¡£ @return $KEY ¤¬¥Õ¥£¥ë¥¿¤µ¤ì¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï 1 ¤òÊÖ¤¹¡£ @@ -4744,20 +4772,20 @@ minput_toggle (MInputContext *ic) @brief Reset an input context. The minput_reset_ic () function resets input context $IC by - calling a callback function corresponding to #Minput_reset. It + calling a callback function corresponding to @b Minput_reset. It resets the status of $IC to its initial one. As the current preedit text is deleted without commitment, if necessary, - call minput_filter () with the arg @r key #Mnil to force the input + call minput_filter () with the arg @b key #Mnil to force the input method to commit the preedit in advance. */ /***ja @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ò¥ê¥»¥Ã¥È¤¹¤ë. - ´Ø¿ô minput_reset_ic () ¤Ï #Minput_reset ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô + ´Ø¿ô minput_reset_ic () ¤Ï @b Minput_reset ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô ¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤ÆÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤ò¥ê¥»¥Ã¥È¤¹¤ë¡£¥ê¥»¥Ã¥È¤È¤Ï¡¢ ¼ÂºÝ¤Ë¤ÏÆþÎϥ᥽¥Ã¥É¤ò½é´ü¾õÂ֤˰ܤ¹¤³¤È¤Ç¤¢¤ë¡£¸½ºßÆþÎÏÃæ¤Î¥Æ¥­¥¹ ¥È¤Ï¥³¥ß¥Ã¥È¤µ¤ì¤ë¤³¤È¤Ê¤¯ºï½ü¤µ¤ì¤ë¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é - ¥à¤Ï¡¢É¬Íפʤé¤Ðͽ¤á minput_filter () ¤ò°ú¿ô @r key #Mnil ¤Ç¸Æ¤ó¤Ç + ¥à¤Ï¡¢É¬Íפʤé¤Ðͽ¤á minput_filter () ¤ò°ú¿ô @b key #Mnil ¤Ç¸Æ¤ó¤Ç ¶¯À©Åª¤Ë¥×¥ê¥¨¥Ç¥£¥Ã¥È¥Æ¥­¥¹¥È¤ò¥³¥ß¥Ã¥È¤µ¤»¤ë¤³¤È¡£ */ void @@ -4923,11 +4951,11 @@ minput_get_description (MSymbol language, MSymbol name) command has no description. @c STATUS is a symbol representing how the key assignment is decided. - The value is #Mnil (the default key assignment), #Mcustomized (the + The value is #Mnil (the default key assignment), @b Mcustomized (the key assignment is customized by per-user customization file), or - #Mconfigured (the key assignment is set by the call of + @b Mconfigured (the key assignment is set by the call of minput_config_command ()). For a local command only, it may also - be #Minherited (the key assignment is inherited from the + be @b Minherited (the key assignment is inherited from the corresponding global command). @c KEYSEQ is a plist of one or more symbols representing a key @@ -4977,11 +5005,11 @@ minput_get_description (MSymbol language, MSymbol name) ¤Ï #Mnil ¤Ç¤¢¤ë¡£ @c STATUS ¤Ï¥­¡¼³ä¤êÅö¤Æ¤¬¤É¤Î¤è¤¦¤ËÄê¤á¤é¤ì¤ë¤«¤ò¤¢¤é¤ï¤¹¥·¥ó¥Ü¥ë - ¤Ç¤¢¤ê¡¢¤½¤ÎÃÍ¤Ï #Mnil ¡Ê¥Ç¥Õ¥©¥ë¥È¤Î³ä¤êÅö¤Æ¡Ë, #Mcustomized ¡Ê¥æ¡¼ + ¤Ç¤¢¤ê¡¢¤½¤ÎÃÍ¤Ï #Mnil ¡Ê¥Ç¥Õ¥©¥ë¥È¤Î³ä¤êÅö¤Æ¡Ë, @b Mcustomized ¡Ê¥æ¡¼ ¥¶Ëè¤Î¥«¥¹¥¿¥Þ¥¤¥º¥Õ¥¡¥¤¥ë¤Ë¤è¤Ã¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤µ¤ì¤¿³ä¤êÅö¤Æ¡Ë, - #Mconfigured ¡Êminput_config_command ()¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë + @b Mconfigured ¡Êminput_config_command ()¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë ³ä¤êÅö¤Æ¡Ë¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£¥í¡¼¥«¥ë¥³¥Þ¥ó¥É¤Î¾ì¹ç¤Ë¤Ï¡¢ - #Minherited ¡ÊÂбþ¤¹¤ë¥°¥í¡¼¥Ð¥ë¥³¥Þ¥ó¥É¤«¤é¤Î·Ñ¾µ¤Ë¤è¤ë³ä¤êÅö¤Æ¡Ë + @b Minherited ¡ÊÂбþ¤¹¤ë¥°¥í¡¼¥Ð¥ë¥³¥Þ¥ó¥É¤«¤é¤Î·Ñ¾µ¤Ë¤è¤ë³ä¤êÅö¤Æ¡Ë ¤Ç¤â¤è¤¤¡£ @c KEYSEQ ¤Ï£±¤Ä°Ê¾å¤Î¥·¥ó¥Ü¥ë¤«¤é¤Ê¤ë plist ¤Ç¤¢¤ê¡¢³Æ¥·¥ó¥Ü¥ë¤Ï¥³¥Þ @@ -5321,10 +5349,10 @@ minput_config_command (MSymbol language, MSymbol name, MSymbol command, variable has no description. @c STATUS is a symbol representing how the value is decided. The - value is #Mnil (the default value), #Mcustomized (the value is - customized by per-user customization file), or #Mconfigured (the + value is #Mnil (the default value), @b Mcustomized (the value is + customized by per-user customization file), or @b Mconfigured (the value is set by the call of minput_config_variable ()). For a - local variable only, it may also be #Minherited (the value is + local variable only, it may also be @b Minherited (the value is inherited from the corresponding global variable). @c VALUE is the initial value of the variable. If the key of this @@ -5381,10 +5409,10 @@ minput_config_command (MSymbol language, MSymbol name, MSymbol command, #Mnil ¤Ç¤¢¤ë¡£ @c STATUS ¤ÏÃͤ¬¤É¤Î¤è¤¦¤ËÄê¤á¤é¤ì¤ë¤«¤ò¤¢¤é¤ï¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ê¡¢ - @c STATUS ¤ÎÃÍ¤Ï #Mnil ¡Ê¥Ç¥Õ¥©¥ë¥È¤ÎÃÍ¡Ë, #Mcustomized ¡Ê¥æ¡¼¥¶Ëè¤Î - ¥«¥¹¥¿¥Þ¥¤¥º¥Õ¥¡¥¤¥ë¤Ë¤è¤Ã¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤µ¤ì¤¿ÃÍ¡Ë, #Mconfigured + @c STATUS ¤ÎÃÍ¤Ï #Mnil ¡Ê¥Ç¥Õ¥©¥ë¥È¤ÎÃÍ¡Ë, @b Mcustomized ¡Ê¥æ¡¼¥¶Ëè¤Î + ¥«¥¹¥¿¥Þ¥¤¥º¥Õ¥¡¥¤¥ë¤Ë¤è¤Ã¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤µ¤ì¤¿ÃÍ¡Ë, @b Mconfigured ¡Êminput_config_variable ()¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ëÃ͡ˤΤ¤¤º¤ì - ¤«¤Ç¤¢¤ë¡£¥í¡¼¥«¥ëÊÑ¿ô¤Î¾ì¹ç¤Ë¤Ï¡¢#Minherited ¡ÊÂбþ¤¹¤ë¥°¥í¡¼¥Ð¥ë + ¤«¤Ç¤¢¤ë¡£¥í¡¼¥«¥ëÊÑ¿ô¤Î¾ì¹ç¤Ë¤Ï¡¢@b Minherited ¡ÊÂбþ¤¹¤ë¥°¥í¡¼¥Ð¥ë ÊÑ¿ô¤«¤é·Ñ¾µ¤·¤¿Ã͡ˤǤâ¤è¤¤¡£ @c VALUE ¤ÏÊÑ¿ô¤Î½é´üÃͤǤ¢¤ë¡£¤³¤ÎÍ×ÁǤΥ­¡¼¤¬#Mt ¤Ç¤¢¤ì¤Ð½é´üÃͤò»ý @@ -6061,7 +6089,7 @@ minput_get_variables (MSymbol language, MSymbol name) @return If the operation was successful, 0 is returned. Otherwise -1 is - returned, and #merror_code is set to #MERROR_IM. */ + returned, and #merror_code is set to @c MERROR_IM. */ /***ja @brief ÆþÎϥ᥽¥Ã¥ÉÊÑ¿ô¤Î½é´üÃͤòÀßÄꤹ¤ë. @@ -6075,7 +6103,7 @@ minput_get_variables (MSymbol language, MSymbol name) @return ½èÍý¤¬À®¸ù¤¹¤ì¤Ð 0 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤·¡¢ - #merror_code ¤ò #MERROR_IM ¤ËÀßÄꤹ¤ë¡£ */ + #merror_code ¤ò @c MERROR_IM ¤ËÀßÄꤹ¤ë¡£ */ int minput_set_variable (MSymbol language, MSymbol name, @@ -6244,7 +6272,7 @@ minput_get_commands (MSymbol language, MSymbol name) @return If the operation was successful, 0 is returned. Otherwise -1 is - returned, and #merror_code is set to #MERROR_IM. */ + returned, and #merror_code is set to @c MERROR_IM. */ /***ja @brief ÆþÎϥ᥽¥Ã¥É¥³¥Þ¥ó¥É¤Ë¥­¡¼¥·¡¼¥¯¥¨¥ó¥¹¤ò³ä¤êÅö¤Æ¤ë. @@ -6265,7 +6293,7 @@ minput_get_commands (MSymbol language, MSymbol name) @return ½èÍý¤¬À®¸ù¤¹¤ì¤Ð 0 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤·¡¢ - #merror_code ¤ò #MERROR_IM ¤ËÀßÄꤹ¤ë¡£ */ + #merror_code ¤ò @c MERROR_IM ¤ËÀßÄꤹ¤ë¡£ */ int minput_assign_command_keys (MSymbol language, MSymbol name, diff --git a/src/internal-flt.h b/src/internal-flt.h index e47dbb1..a4e39a0 100644 --- a/src/internal-flt.h +++ b/src/internal-flt.h @@ -38,15 +38,11 @@ #define COMBINING_CODE_ADD_X(code) (((code) >> 2) & 0x3) #define COMBINING_CODE_ADD_Y(code) ((code) & 0x3) -#define MAKE_COMBINING_CODE_BY_CLASS(class) (0x1000000 | class) - -#define COMBINING_BY_CLASS_P(code) ((code) & 0x1000000) - -#define COMBINING_CODE_CLASS(code) ((code) & 0xFFFFFF) - -#define MAKE_PRECOMPUTED_COMBINDING_CODE() (0x2000000) - -#define COMBINING_PRECOMPUTED_P(code) ((code) & 0x2000000) +#define PACK_OTF_TAG(TAG) \ + ((((TAG) & 0x7F000000) >> 3) \ + | (((TAG) & 0x7F0000) >> 2) \ + | (((TAG) & 0x7F00) >> 1) \ + | ((TAG) & 0x7F)) extern MSymbol Mcombining; diff --git a/src/internal.h b/src/internal.h index 4091c4e..06cd409 100644 --- a/src/internal.h +++ b/src/internal.h @@ -550,6 +550,7 @@ enum MDebugFlag MDEBUG_DATABASE, MDEBUG_FONT, MDEBUG_FLT, + MDEBUG_FONTSET, MDEBUG_INPUT, MDEBUG_ALL, MDEBUG_MAX = MDEBUG_ALL diff --git a/src/language.c b/src/language.c index 168a27e..1e3d85c 100644 --- a/src/language.c +++ b/src/language.c @@ -317,11 +317,21 @@ mscript__from_otf_tag (MSymbol otf_tag) && (p = MPLIST_NEXT (p)) /* char list */ && ! MPLIST_TAIL_P (p) && (p = MPLIST_NEXT (p)) /* otf tag */ - && MPLIST_SYMBOL_P (p) - && otf_tag == MPLIST_SYMBOL (p)) + && ! MPLIST_TAIL_P (p)) { - script = MPLIST_SYMBOL (pl); - break; + if (MPLIST_SYMBOL_P (p)) + { + if (otf_tag == MPLIST_SYMBOL (p)) + return MPLIST_SYMBOL (pl); + } + else if (MPLIST_PLIST (p)) + { + MPlist *p0; + + MPLIST_DO (p0, MPLIST_PLIST (p)) + if (MPLIST_SYMBOL_P (p0) && otf_tag == MPLIST_SYMBOL (p0)) + return MPLIST_SYMBOL (pl); + } } } return script; diff --git a/src/m17n-X.c b/src/m17n-X.c index 62e0b1f..0fd4b16 100644 --- a/src/m17n-X.c +++ b/src/m17n-X.c @@ -657,12 +657,11 @@ xfont_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) font->type = MFONT_TYPE_FAILURE; return NULL; } - MDEBUG_PRINT1 (" [XFONT] o %s\n", name); - free (name); M17N_OBJECT (x_rfont, close_xfont, MERROR_FONT_X); x_rfont->display = display; x_rfont->xfont = xfont; MSTRUCT_CALLOC (rfont, MERROR_FONT_X); + rfont->id = msymbol (name); rfont->spec = this; rfont->spec.type = MFONT_TYPE_REALIZED; rfont->spec.source = MFONT_SOURCE_X; @@ -688,6 +687,8 @@ xfont_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) rfont->fontp = xfont; rfont->next = MPLIST_VAL (frame->realized_font_list); MPLIST_VAL (frame->realized_font_list) = rfont; + MDEBUG_PRINT1 (" [XFONT] o %s\n", name); + free (name); return rfont; } @@ -1055,11 +1056,19 @@ static int xft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, int from, int to, MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment); +static int xft_try_otf (MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *in, int from, int to); +static int xft_iterate_otf_feature (struct _MFLTFont *font, MFLTOtfSpec *spec, + int from, int to, unsigned char *table); + static MFontDriver xft_driver = { NULL, xft_open, xft_find_metric, xft_has_char, xft_encode_char, xft_render, NULL, NULL, - xft_check_capability, NULL, NULL, xft_check_otf, xft_drive_otf + xft_check_capability, NULL, NULL, xft_check_otf, xft_drive_otf, xft_try_otf, +#ifdef HAVE_OTF + xft_iterate_otf_feature +#endif /* HAVE_OTF */ }; static void @@ -1156,6 +1165,7 @@ xft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) rfont_xft->info = rfont->info; M17N_OBJECT_REF (rfont->info); MSTRUCT_CALLOC (rfont, MERROR_FONT_X); + rfont->id = font->file; rfont->spec = *spec; rfont->spec.size = size; rfont->frame = frame; @@ -1370,6 +1380,30 @@ xft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, return result; } +static int +xft_try_otf (MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *in, int from, int to) +{ + return xft_drive_otf (font, spec, in, from, to, NULL, NULL); +} + +#ifdef HAVE_OTF + +static int +xft_iterate_otf_feature (struct _MFLTFont *font, MFLTOtfSpec *spec, + int from, int to, unsigned char *table) +{ + MRealizedFont *rfont = ((MFLTFontForRealized *) font)->rfont; + MRealizedFontXft *rfont_xft = rfont->info; + int result; + + rfont->info = rfont_xft->info; + result = mfont__ft_driver.iterate_otf_feature (font, spec, from, to, table); + rfont->info = rfont_xft; + return result; +} +#endif /* HAVE_OTF */ + #endif /* HAVE_XFT2 */ @@ -2577,7 +2611,7 @@ xim_lookup (MInputContext *ic, MSymbol key, void *arg, MText *mt) /*** @addtogroup m17nInputMethodWin */ /*** @{ */ - +/*=*/ /***en @brief Input method driver for XIM. @@ -2635,9 +2669,9 @@ xim_lookup (MInputContext *ic, MSymbol key, void *arg, MText *mt) MInputDriver minput_xim_driver = { xim_open_im, xim_close_im, xim_create_ic, xim_destroy_ic, xim_filter, xim_lookup, NULL }; - +/*=*/ /*** @} */ - +/*=*/ #else /* not HAVE_X11 */ int device_open () { return -1; } diff --git a/src/m17n-X.h b/src/m17n-X.h index d239a13..1f4199e 100644 --- a/src/m17n-X.h +++ b/src/m17n-X.h @@ -102,11 +102,11 @@ typedef struct { /***en Used as the arguments of @c XCreateIC following @c XNInputStyle. If this is zero, ( @c XIMPreeditNothing | @c - XIMStatusNothing) is used, and and - are set to @c NULL. */ + XIMStatusNothing) is used, and \ and + \ are set to @c NULL. */ /***ja @c XCreateIC ¤Î @c XNInputStyle ¤Ë³¤¯°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ ¥¼¥í¤Ê¤é¤Ð¡¢ ( @c XIMPreeditNothing | @c XIMStatusNothing) ¤¬ÍÑ - ¤¤¤é¤ì¡¢ ¤È ¤Ï @c NULL + ¤¤¤é¤ì¡¢ \ ¤È \ ¤Ï @c NULL ¤ËÀßÄꤵ¤ì¤ë¡£ */ XIMStyle input_style; diff --git a/src/m17n-core.c b/src/m17n-core.c index a486051..41bb939 100644 --- a/src/m17n-core.c +++ b/src/m17n-core.c @@ -1,5 +1,5 @@ /* m17n-core.c -- body of the CORE API. - Copyright (C) 2003, 2004, 2005, 2006, 2007 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -434,6 +434,27 @@ report_object_array () fprintf (stderr, "%16s %7d %7d %7d\n", array->name, array->used, array->used - array->count, array->count); + if (array->count > 0) + { + int i; + for (i = 0; i < array->used && ! array->objects[i]; i++); + + if (strcmp (array->name, "M-text") == 0) + { + MText *mt = (MText *) array->objects[i]; + + if (mt->format <= MTEXT_FORMAT_UTF_8) + fprintf (stderr, "\t\"%s\"\n", (char *) mt->data); + } + else if (strcmp (array->name, "Plist") == 0) + { + MPlist *plist = (MPlist *) array->objects[i]; + + mdebug_dump_plist (plist, 8); + fprintf (stderr, "\n"); + } + } + if (array->used > 0) { free (array->objects); @@ -567,6 +588,7 @@ m17n_init_core (void) SET_DEBUG_FLAG ("MDEBUG_DATABASE", MDEBUG_DATABASE); SET_DEBUG_FLAG ("MDEBUG_FONT", MDEBUG_FONT); SET_DEBUG_FLAG ("MDEBUG_FLT", MDEBUG_FLT); + SET_DEBUG_FLAG ("MDEBUG_FONTSET", MDEBUG_FONTSET); SET_DEBUG_FLAG ("MDEBUG_INPUT", MDEBUG_INPUT); /* for backward compatibility... */ SET_DEBUG_FLAG ("MDEBUG_FONT_FLT", MDEBUG_FLT); diff --git a/src/m17n-core.h b/src/m17n-core.h index 819227e..0c8d7f9 100644 --- a/src/m17n-core.h +++ b/src/m17n-core.h @@ -1,5 +1,5 @@ /* m17n-core.h -- header file for the CORE API of the m17n library. - Copyright (C) 2003, 2004, 2005, 2006 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -47,8 +47,8 @@ M17N_BEGIN_HEADER #define M17NLIB_MAJOR_VERSION 1 #define M17NLIB_MINOR_VERSION 5 -#define M17NLIB_PATCH_LEVEL 2 -#define M17NLIB_VERSION_NAME "1.5.2" +#define M17NLIB_PATCH_LEVEL 5 +#define M17NLIB_VERSION_NAME "1.5.5" extern void m17n_init_core (void); #define M17N_INIT() m17n_init_core () @@ -119,6 +119,7 @@ extern enum M17NStatus m17n_status (void); typedef struct { + /*** Hidden from applications. */ void *filler[2]; } M17NObjectHead; @@ -311,6 +312,8 @@ extern MSymbol Mcombining_class; extern MSymbol Mbidi_category; extern MSymbol Msimple_case_folding; extern MSymbol Mcomplicated_case_folding; +extern MSymbol Mcased, Msoft_dotted, Mcase_mapping; +extern MSymbol Mblock; extern MSymbol mchar_define_property (const char *name, MSymbol type); @@ -418,11 +421,17 @@ typedef struct MText MText; enum MTextFormat { + /*** US-ASCII encoding */ MTEXT_FORMAT_US_ASCII, + /*** UTF-8 encoding */ MTEXT_FORMAT_UTF_8, + /*** UTF-16LE encoding */ MTEXT_FORMAT_UTF_16LE, + /*** UTF-16BE encoding */ MTEXT_FORMAT_UTF_16BE, + /*** UTF-32LE encoding */ MTEXT_FORMAT_UTF_32LE, + /*** UTF-32BE encoding */ MTEXT_FORMAT_UTF_32BE, MTEXT_FORMAT_BINARY, MTEXT_FORMAT_MAX @@ -581,6 +590,7 @@ extern int mtext_titlecase (MText *mt); extern int mtext_uppercase (MText *mt); +/*** @ingroup m17nMtext */ /***en @brief Enumeration for specifying a set of line breaking option. @@ -712,7 +722,7 @@ typedef MPlist *(*MTextPropSerializeFunc) (void *val); @brief ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿Àë¸À. ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£ ¤¢¤ë¥·¥ó¥Ü¥ë¤Î¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤¬ @c - #Msymbol_prop_deserializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ + #Mtext_prop_deserializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ @seealso Mtext_prop_deserialize (), Mtext_prop_deserializer diff --git a/src/m17n-flt.c b/src/m17n-flt.c index 6c82679..c0ae65b 100644 --- a/src/m17n-flt.c +++ b/src/m17n-flt.c @@ -1,5 +1,5 @@ /* m17n-flt.c -- Font Layout Table sub-module. - Copyright (C) 2003, 2004, 2007 + Copyright (C) 2003, 2004, 2007, 2008, 2009 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -122,9 +122,9 @@ PREDEFIND-COMMAND ::= ;; consume nothing. OTF-COMMAND ::= - 'otf:''SCRIPT'[':'['LANGSYS'][':'[GSUB-FEATURES][':'GPOS-FEATURES]]] + ':otf=''SCRIPT'[':'['LANGSYS'][':'[GSUB-FEATURES][':'GPOS-FEATURES]]] ;; Run the Open Type Layout Table on the current run. Succeed always, -;; consume nothing. +;; consume all glyphs in the current range. SCRIPT ::= OTF-TAG ;; OTF's ScriptTag name (four letters) listed at: @@ -255,7 +255,9 @@ static int flt_min_coverage, flt_max_coverage; enum GlyphInfoMask { - CombiningCodeMask = 0xFFFFFFF, + CategoryCodeMask = 0x7F, + CombiningCodeMask = 0xFFFFFF, + CombinedMask = 1 << 27, LeftPaddingMask = 1 << 28, RightPaddingMask = 1 << 29 }; @@ -264,9 +266,15 @@ enum GlyphInfoMask ((g)->internal = (((g)->internal & ~(mask)) | (info)), \ (ctx)->check_mask |= (mask)) +#define GET_CATEGORY_CODE(g) ((g)->internal & CategoryCodeMask) +#define SET_CATEGORY_CODE(g, code) \ + ((g)->internal = (((g)->internal & ~(CombiningCodeMask | CombinedMask)) \ + | (code))) +#define GET_COMBINED(g) ((g)->internal & CombinedMask) #define GET_COMBINING_CODE(g) ((g)->internal & CombiningCodeMask) -#define SET_COMBINING_CODE(g, ctx, code) \ - SET_GLYPH_INFO (g, CombiningCodeMask, ctx, code) +#define SET_COMBINING_CODE(g, ctx, code) \ + SET_GLYPH_INFO (g, CombiningCodeMask | CombinedMask, ctx, \ + (code) | CombinedMask) #define GET_LEFT_PADDING(g) ((g)->internal & LeftPaddingMask) #define SET_LEFT_PADDING(g, ctx, flag) \ SET_GLYPH_INFO (g, LeftPaddingMask, ctx, flag) @@ -435,6 +443,7 @@ enum FontLayoutCmdType FontLayoutCmdTypeRule, FontLayoutCmdTypeCond, FontLayoutCmdTypeOTF, + FontLayoutCmdTypeOTFCategory, FontLayoutCmdTypeMAX }; @@ -448,9 +457,25 @@ typedef struct } body; } FontLayoutCmd; +typedef struct +{ + int size; + unsigned int *tag; + char *code; +} FeatureCodeTable; + +typedef struct +{ + MCharTable *table; + FeatureCodeTable feature_table; + /* Non-null if the table must be re-configured by OTF specs included + in the definition. */ + MPlist *definition; +} FontLayoutCategory; + typedef struct { - MCharTable *category; + FontLayoutCategory *category; int size, inc, used; FontLayoutCmd *cmds; } FontLayoutStage; @@ -462,39 +487,83 @@ struct _MFLT MSymbol registry; MFLTOtfSpec otf; MDatabase *mdb; - MCharTable *coverage; + FontLayoutCategory *coverage; MPlist *stages; + int need_config; + /* Font for which coverage or some of categories are configured. */ + MSymbol font_id; }; /* Font layout table loader */ static int parse_otf_command (MSymbol symbol, MFLTOtfSpec *spec); +static void +apply_otf_feature (MFLTFont *font, MFLTOtfSpec *spec, + int from, int to, MCharTable *table, int category) +{ + unsigned char *buf; + int i; + + if (! mflt_iterate_otf_feature) + return; + buf = alloca (to + 1 - from); + memset (buf, 0, to + 1 - from); + if (mflt_iterate_otf_feature (font, spec, from, to, buf) < 0) + return; + for (i = to - from; i >= 0; i--) + if (buf[i]) + mchartable_set (table, from + i, (void *) category); +} + +static unsigned int gen_otf_tag (char *p, int shift); + /* Load a category table from PLIST. PLIST has this form: PLIST ::= ( FROM-CODE TO-CODE ? CATEGORY-CHAR ) * */ -static MCharTable * -load_category_table (MPlist *plist) +static FontLayoutCategory * +load_category_table (MPlist *plist, MFLTFont *font) { + FontLayoutCategory *category; MCharTable *table; + MPlist *feature_table_head = NULL; + int feature_table_size = 0; + MPlist *p; + int need_otf = 0; table = mchartable (Minteger, (void *) 0); - - MPLIST_DO (plist, plist) + MPLIST_DO (p, plist) { MPlist *elt; int from, to, category_code; - if (! MPLIST_PLIST (plist)) - MERROR (MERROR_FONT, NULL); - elt = MPLIST_PLIST (plist); + if (! MPLIST_PLIST_P (p)) + MERROR_GOTO (MERROR_FLT, end); + elt = MPLIST_PLIST (p); + if (MPLIST_SYMBOL_P (elt)) + { + MPlist *next; + + if (! mflt_enable_new_feature) + { + M17N_OBJECT_UNREF (table); + return NULL; + } + next = MPLIST_NEXT (elt); + if (! MPLIST_INTEGER_P (next)) + MERROR_GOTO (MERROR_FLT, end); + if (! feature_table_head) + feature_table_head = p; + feature_table_size++; + continue; + } if (! MPLIST_INTEGER_P (elt)) - MERROR (MERROR_FONT, NULL); + MERROR_GOTO (MERROR_FLT, end); from = MPLIST_INTEGER (elt); elt = MPLIST_NEXT (elt); if (! MPLIST_INTEGER_P (elt)) - MERROR (MERROR_FONT, NULL); + MERROR_GOTO (MERROR_FLT, end); to = MPLIST_INTEGER (elt); elt = MPLIST_NEXT (elt); if (MPLIST_TAIL_P (elt)) @@ -502,14 +571,38 @@ load_category_table (MPlist *plist) category_code = to; to = from; } + else if (MPLIST_SYMBOL_P (elt)) + { + if (! mflt_enable_new_feature) + { + M17N_OBJECT_UNREF (table); + return NULL; + } + if (font) + { + MFLTOtfSpec spec; + if (parse_otf_command (MPLIST_SYMBOL (elt), &spec) < 0) + MERROR_GOTO (MERROR_FLT, end); + elt = MPLIST_NEXT (elt); + if (! MPLIST_INTEGER_P (elt)) + MERROR_GOTO (MERROR_FLT, end); + category_code = MPLIST_INTEGER (elt); + if (! isalnum (category_code)) + MERROR_GOTO (MERROR_FLT, end); + apply_otf_feature (font, &spec, from, to, table, category_code); + } + else + need_otf = 1; + continue; + } else { if (! MPLIST_INTEGER_P (elt)) - MERROR (MERROR_FONT, NULL); + MERROR_GOTO (MERROR_FLT, end); category_code = MPLIST_INTEGER (elt); } if (! isalnum (category_code)) - MERROR (MERROR_FONT, NULL); + MERROR_GOTO (MERROR_FLT, end); if (from == to) mchartable_set (table, from, (void *) category_code); @@ -517,19 +610,75 @@ load_category_table (MPlist *plist) mchartable_set_range (table, from, to, (void *) category_code); } - return table; + end: + category = calloc (1, sizeof (FontLayoutCategory)); + category->table = table; + if (need_otf) + { + category->definition = plist; + M17N_OBJECT_REF (plist); + } + else + category->definition = NULL; + if (feature_table_head) + { + int i = 0; + category->feature_table.size = feature_table_size; + category->feature_table.tag = malloc (sizeof (unsigned int) + * feature_table_size); + category->feature_table.code = malloc (feature_table_size); + + MPLIST_DO (p, feature_table_head) + { + MPlist *elt; + MSymbol feature; + if (! MPLIST_PLIST_P (p)) + continue; + elt = MPLIST_PLIST (p); + if (! MPLIST_SYMBOL_P (elt)) + continue; + feature = MPLIST_SYMBOL (elt); + elt = MPLIST_NEXT (elt); + if (! MPLIST_INTEGER_P (elt)) + continue; + category->feature_table.tag[i] + = gen_otf_tag (MSYMBOL_NAME (feature), 7); + category->feature_table.code[i] = MPLIST_INTEGER (elt); + i++; + } + } + return category; +} + +#define ref_category_table(CATEGORY) M17N_OBJECT_REF ((CATEGORY)->table) + +static void +unref_category_table (FontLayoutCategory *category) +{ + M17N_OBJECT_UNREF (category->table); + if (! category->table) + { + if (category->definition) + M17N_OBJECT_UNREF (category->definition); + if (category->feature_table.size > 0) + { + free (category->feature_table.tag); + free (category->feature_table.code); + } + free (category); + } } static unsigned int -gen_otf_tag (char *p) +gen_otf_tag (char *p, int shift) { unsigned int tag = 0; int i; for (i = 0; i < 4 && *p; i++, p++) - tag = (tag << 8) | *p; + tag = (tag << shift) | *p; for (; i < 4; i++) - tag = (tag << 8) | 0x20; + tag = (tag << shift) | 0x20; return tag; } @@ -585,10 +734,10 @@ otf_store_features (char *p, char *end, unsigned *buf) { if (negative++ == 0) buf[i++] = 0xFFFFFFFF; - buf[i++] = gen_otf_tag (p + 1), p += 6; + buf[i++] = gen_otf_tag (p + 1, 8), p += 6; } else - buf[i++] = gen_otf_tag (p), p += 5; + buf[i++] = gen_otf_tag (p, 8), p += 5; } buf[i] = 0; } @@ -606,12 +755,21 @@ parse_otf_command (MSymbol symbol, MFLTOtfSpec *spec) memset (spec, 0, sizeof (MFLTOtfSpec)); spec->sym = symbol; - str += 5; /* skip the heading ":otf=" */ - script = gen_otf_tag (str); + str += 5; /* skip the heading ":otf=" or ":otf?" */ + if (str[-1] == '?') + { + if (! mflt_enable_new_feature) + /* The client can't use this command. */ + return -1; + if (! *str) + /* This is a spec to reset category codes. */ + return 0; + } + script = gen_otf_tag (str, 8); str += 4; if (*str == '/') { - langsys = gen_otf_tag (str); + langsys = gen_otf_tag (str, 8); str += 4; } else @@ -694,7 +852,8 @@ load_otf_command (FontLayoutCmd *cmd, MSymbol sym) result = parse_otf_command (sym, &cmd->body.otf); if (result == -2) return result; - cmd->type = FontLayoutCmdTypeOTF; + cmd->type = (name[4] == '?' ? FontLayoutCmdTypeOTFCategory + : FontLayoutCmdTypeOTF); return 0; } @@ -820,6 +979,7 @@ load_command (FontLayoutStage *stage, MPlist *plist, /* PLIST ::= ( cond ... ) | ( STRING ... ) | ( INTEGER ... ) | ( ( INTEGER INTEGER ) ... ) | ( ( range INTEGER INTEGER ) ... ) + | ( ( SYMBOL STRING ) ... ) | ( ( font-facilty [ INTEGER ] ) ... ) | ( ( font-facilty OTF-SPEC ) ... ) */ MPlist *elt = MPLIST_PLIST (plist); @@ -1031,7 +1191,7 @@ load_command (FontLayoutStage *stage, MPlist *plist, && ((name[0] == 'o' && name[1] == 't' && name[2] == 'f' && name[3] == ':') || (name[0] == ':' && name[1] == 'o' && name[2] == 't' - && name[3] == 'f' && name[4] == '='))) + && name[3] == 'f' && (name[4] == '=' || name[4] == '?')))) { result = load_otf_command (&cmd, sym); if (result < 0) @@ -1111,7 +1271,8 @@ free_flt_command (FontLayoutCmd *cmd) } else if (cmd->type == FontLayoutCmdTypeCond) free (cmd->body.cond.cmd_ids); - else if (cmd->type == FontLayoutCmdTypeOTF) + else if (cmd->type == FontLayoutCmdTypeOTF + || cmd->type == FontLayoutCmdTypeOTFCategory) { if (cmd->body.otf.features[0]) free (cmd->body.otf.features[0]); @@ -1169,7 +1330,7 @@ static int load_flt (MFLT *flt, MPlist *key_list) { MPlist *top, *plist, *pl, *p; - MCharTable *category = NULL; + FontLayoutCategory *category = NULL; MSymbol sym; if (key_list) @@ -1246,18 +1407,23 @@ load_flt (MFLT *flt, MPlist *key_list) if (sym == Mcategory) { if (category) - M17N_OBJECT_UNREF (category); + unref_category_table (category); else if (flt->coverage) { category = flt->coverage; + ref_category_table (category); continue; } - category = load_category_table (pl); + category = load_category_table (pl, NULL); + if (! category) + goto err; if (! flt->coverage) { flt->coverage = category; - M17N_OBJECT_REF (category); + ref_category_table (category); } + if (category->definition) + flt->need_config = 1; } else if (sym == Mgenerator) { @@ -1269,14 +1435,15 @@ load_flt (MFLT *flt, MPlist *key_list) if (! stage) break; stage->category = category; - M17N_OBJECT_REF (category); + M17N_OBJECT_REF (category->table); if (! flt->stages) flt->stages = mplist (); mplist_add (flt->stages, Mt, stage); } } if (category) - M17N_OBJECT_UNREF (category); + unref_category_table (category); + err: if (! MPLIST_TAIL_P (plist)) { M17N_OBJECT_UNREF (top); @@ -1289,14 +1456,17 @@ load_flt (MFLT *flt, MPlist *key_list) static void -free_flt_stage (FontLayoutStage *stage) +free_flt_stage (MFLT *flt, FontLayoutStage *stage) { int i; - M17N_OBJECT_UNREF (stage->category); - for (i = 0; i < stage->used; i++) - free_flt_command (stage->cmds + i); - MLIST_FREE1 (stage, cmds); + unref_category_table (stage->category); + if (! flt->font_id) + { + for (i = 0; i < stage->used; i++) + free_flt_command (stage->cmds + i); + MLIST_FREE1 (stage, cmds); + } free (stage); } @@ -1312,13 +1482,15 @@ free_flt_list () MFLT *flt = MPLIST_VAL (plist); if (flt->coverage) - M17N_OBJECT_UNREF (flt->coverage); + unref_category_table (flt->coverage); if (flt->stages) { MPLIST_DO (pl, MPLIST_NEXT (flt->stages)) - free_flt_stage (MPLIST_VAL (pl)); + free_flt_stage (flt, MPLIST_VAL (pl)); M17N_OBJECT_UNREF (flt->stages); } + free (flt); + MPLIST_VAL (plist) = NULL; } M17N_OBJECT_UNREF (flt_list); } @@ -1356,17 +1528,17 @@ list_flt () { if (MPLIST_TAIL_P (flt_list)) { - flt_min_coverage = mchartable_min_char (flt->coverage); - flt_max_coverage = mchartable_max_char (flt->coverage); + flt_min_coverage = mchartable_min_char (flt->coverage->table); + flt_max_coverage = mchartable_max_char (flt->coverage->table); } else { int c; - c = mchartable_min_char (flt->coverage); + c = mchartable_min_char (flt->coverage->table); if (flt_min_coverage > c) flt_min_coverage = c; - c = mchartable_max_char (flt->coverage); + c = mchartable_max_char (flt->coverage->table); if (flt_max_coverage < c) flt_max_coverage = c; } @@ -1394,6 +1566,9 @@ typedef struct /* Pointer to the current stage. */ FontLayoutStage *stage; + /* Pointer to the category table of the next stage or NULL if none. */ + FontLayoutCategory *category; + /* Pointer to the font. */ MFLTFont *font; @@ -1416,6 +1591,8 @@ typedef struct } FontLayoutContext; static int run_command (int, int, int, int, FontLayoutContext *); +static int run_otf (int, MFLTOtfSpec *, int, int, FontLayoutContext *); +static int try_otf (int, MFLTOtfSpec *, int, int, FontLayoutContext *); #define NMATCH 20 @@ -1479,7 +1656,7 @@ run_rule (int depth, if (len > (to - from)) return 0; for (i = 0; i < len; i++) - if (rule->src.seq.codes[i] != GREF (ctx->in, from + i)->code) + if (rule->src.seq.codes[i] != GREF (ctx->in, from + i)->c) break; if (i < len) return 0; @@ -1495,7 +1672,7 @@ run_rule (int depth, if (from >= to) return 0; - head = GREF (ctx->in, from)->code; + head = GREF (ctx->in, from)->c; if (head < rule->src.range.from || head > rule->src.range.to) return 0; ctx->code_offset = head - rule->src.range.from; @@ -1549,12 +1726,12 @@ run_rule (int depth, { if (MPLIST_INTEGER_P (p)) { - GREF (&gstring, i)->code = MPLIST_INTEGER (p); + GREF (&gstring, i)->c = MPLIST_INTEGER (p); GREF (&gstring, i)->encoded = 0; } else { - GREF (&gstring, i)->code = GREF (ctx->in, idx)->code; + GREF (&gstring, i)->c = GREF (ctx->in, idx)->code; GREF (&gstring, i)->encoded = GREF (ctx->in, idx)->encoded; idx++; } @@ -1688,6 +1865,44 @@ run_cond (int depth, return (pos); } +static void +decode_packed_otf_tag (FontLayoutContext *ctx, MFLTGlyphString *gstring, + int from, int to, FontLayoutCategory *category) +{ + for (; from < to; from++) + { + MFLTGlyph *g = GREF (gstring, from); + unsigned int tag = g->internal & 0xFFFFFFF; + char enc; + + if (! category) + { + SET_CATEGORY_CODE (g, 0); + continue; + } + if (tag & 0xFFFFF80) + { + int i; + + /* Clear the feature tag code. */ + g->internal &= ~0xFFFFFFF; + for (i = 0, enc = '\0'; i < category->feature_table.size; i++) + if (category->feature_table.tag[i] == tag) + { + enc = category->feature_table.code[i]; + if (ctx->in == gstring) + ctx->encoded[from - ctx->encoded_offset] = enc; + break; + } + } + else + enc = '\0'; + if (! enc) + enc = g->c > 0 ? (int) mchartable_lookup (category->table, g->c) : 1; + SET_CATEGORY_CODE (g, enc); + } +} + static int run_otf (int depth, MFLTOtfSpec *otf_spec, int from, int to, FontLayoutContext *ctx) @@ -1723,6 +1938,8 @@ run_otf (int depth, adjustment); if (to < 0) return to; + decode_packed_otf_tag (ctx, ctx->out, from_idx, ctx->out->used, + ctx->category); out_len = ctx->out->used - from_idx; if (otf_spec->features[1]) { @@ -1757,6 +1974,10 @@ run_otf (int depth, g->xoff = a->xoff; g->yoff = a->yoff; + g->lbearing += a->xoff; + g->rbearing += a->xoff; + g->ascent -= a->yoff; + g->descent -= a->yoff; while (aa->back > 0) { for (j = 0; j < aa->back; @@ -1790,6 +2011,58 @@ run_otf (int depth, return to; } +static int +try_otf (int depth, MFLTOtfSpec *otf_spec, int from, int to, + FontLayoutContext *ctx) +{ + MFLTFont *font = ctx->font; + int from_idx = ctx->out->used; + + if (MDEBUG_FLAG () > 2) + MDEBUG_PRINT3 ("\n [FLT] %*s%s", depth, "", MSYMBOL_NAME (otf_spec->sym)); + + if (! otf_spec->features[0] && ! otf_spec->features[1]) + { + /* Reset categories. */ + MCharTable *table = ctx->category->table; + int i; + + for (i = from; i < to; i++) + { + MFLTGlyph *g = GREF (ctx->in, i); + + if (! GET_COMBINED (g)) + { + char enc = (GET_ENCODED (g) + ? (g->c > 0 ? (int) mchartable_lookup (table, g->c) + : 1) + : g->code + ? (int) mchartable_lookup (table, g->code) + : ' '); + SET_CATEGORY_CODE (g, enc); + ctx->encoded[i - ctx->encoded_offset] = enc; + } + } + return from; + } + + if (ctx->stage->category->feature_table.size == 0) + return from; + + font->get_glyph_id (font, ctx->in, from, to); + if (mflt_try_otf) + { + int out_len; + int i; + + to = mflt_try_otf (font, otf_spec, ctx->in, from, to); + if (to < 0) + return from; + decode_packed_otf_tag (ctx, ctx->in, from, to, ctx->stage->category); + } + return from; +} + static char work[16]; static char * @@ -1832,6 +2105,8 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) if (id >= 0) { int i; + MCharTable *table = ctx->category ? ctx->category->table : NULL; + char enc; /* Direct code (== ctx->code_offset + id) output. The source is not consumed. */ @@ -1842,10 +2117,19 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) GDUP (ctx, i); g = GREF (ctx->out, ctx->out->used - 1); g->c = g->code = ctx->code_offset + id; - SET_ENCODED (g, 0); - SET_MEASURED (g, 0); if (ctx->combining_code) SET_COMBINING_CODE (g, ctx, ctx->combining_code); + else if (table) + { + enc = (GET_ENCODED (g) + ? (g->c > 0 ? (int) mchartable_lookup (table, g->c) : 1) + : g->code + ? (int) mchartable_lookup (table, g->code) + : ' '); + SET_CATEGORY_CODE (g, enc); + } + SET_ENCODED (g, 0); + SET_MEASURED (g, 0); if (ctx->left_padding) SET_LEFT_PADDING (g, ctx, LeftPaddingMask); for (i = from; i < to; i++) @@ -1879,6 +2163,8 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) to = run_cond (depth, &cmd->body.cond, from, to, ctx); else if (cmd->type == FontLayoutCmdTypeOTF) to = run_otf (depth, &cmd->body.otf, from, to, ctx); + else if (cmd->type == FontLayoutCmdTypeOTFCategory) + to = try_otf (depth, &cmd->body.otf, from, to, ctx); return to; } @@ -1910,7 +2196,7 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) if (g->c < 0) MDEBUG_PRINT2 ("\n [FLT] %*s(COPY |)", depth, ""); else - MDEBUG_PRINT3 ("\n [FLT] %*s(COPY 0x%X)", depth, "", g->code); + MDEBUG_PRINT3 ("\n [FLT] %*s(COPY 0x%X)", depth, "", g->c); } ctx->code_offset = ctx->combining_code = ctx->left_padding = 0; return (from + 1); @@ -1956,6 +2242,7 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) g->xadv = g->yadv = 0; SET_ENCODED (g, 0); SET_MEASURED (g, 0); + SET_CATEGORY_CODE (g, ' '); return from; } @@ -1990,6 +2277,7 @@ run_stages (MFLTGlyphString *gstring, int from, int to, int i, j; MFLTGlyph *g; MPlist *stages = flt->stages; + FontLayoutCategory *prev_category = NULL; from_pos = GREF (ctx->in, from)->from; to_pos = GREF (ctx->in, to - 1)->to; @@ -2008,18 +2296,28 @@ run_stages (MFLTGlyphString *gstring, int from, int to, int result; ctx->stage = (FontLayoutStage *) MPLIST_VAL (stages); - table = ctx->stage->category; + table = ctx->stage->category->table; + stages = MPLIST_NEXT (stages); + if (MPLIST_TAIL_P (stages)) + ctx->category = NULL; + else + ctx->category = ((FontLayoutStage *) MPLIST_VAL (stages))->category; ctx->code_offset = ctx->combining_code = ctx->left_padding = 0; ctx->encoded_offset = from; for (i = from; i < to; i++) { MFLTGlyph *g = GREF (ctx->in, i); - char enc = (GET_ENCODED (g) - ? (g->c > 0 ? (int) mchartable_lookup (table, g->c) : 1) - : g->code - ? (int) mchartable_lookup (table, g->code) - : ' '); - + char enc; + + if (GET_COMBINED (g) + || (prev_category && prev_category != ctx->stage->category)) + enc = (GET_ENCODED (g) + ? (g->c > 0 ? (int) mchartable_lookup (table, g->c) : 1) + : g->code + ? (int) mchartable_lookup (table, g->code) + : ' '); + else + enc = GET_CATEGORY_CODE (g); ctx->encoded[i - from] = enc; if (! enc && stage_idx == 0) { @@ -2054,12 +2352,12 @@ run_stages (MFLTGlyphString *gstring, int from, int to, if (result < 0) return result; - stages = MPLIST_NEXT (stages); /* If this is the last stage, break the loop. */ if (MPLIST_TAIL_P (stages)) break; /* Otherwise, prepare for the next stage. */ + prev_category = ctx->stage->category; temp = ctx->in; ctx->in = ctx->out; if (buf.glyphs) @@ -2144,7 +2442,7 @@ run_stages (MFLTGlyphString *gstring, int from, int to, ctx->font->get_metrics (ctx->font, ctx->out, 0, ctx->out->used); /* Handle combining. */ - if (ctx->check_mask & CombiningCodeMask) + if (ctx->check_mask & CombinedMask) { MFLTGlyph *base = GREF (ctx->out, 0); int base_height = base->ascent + base->descent; @@ -2154,6 +2452,7 @@ run_stages (MFLTGlyphString *gstring, int from, int to, for (i = 1; i < ctx->out->used; i++) { if ((g = GREF (ctx->out, i)) + && GET_COMBINED (g) && (combining_code = GET_COMBINING_CODE (g))) { int height = g->ascent + g->descent; @@ -2209,7 +2508,7 @@ run_stages (MFLTGlyphString *gstring, int from, int to, for (i = 0; i < ctx->out->used; i++) { g = GREF (ctx->out, i); - if (! GET_COMBINING_CODE (g)) + if (! GET_COMBINED (g)) { if (GET_RIGHT_PADDING (g) && g->rbearing > g->xadv) { @@ -2267,14 +2566,67 @@ setup_combining_flt (MFLT *flt) MCharTable *combininig_class_table = mchar_get_prop_table (Mcombining_class, &type); - mchartable_set_range (flt->coverage, 0, 0x10FFFF, (void *) 'u'); + mchartable_set_range (flt->coverage->table, 0, 0x10FFFF, (void *) 'u'); if (combininig_class_table) mchartable_map (combininig_class_table, (void *) 0, - setup_combining_coverage, flt->coverage); + setup_combining_coverage, flt->coverage->table); } #define CHECK_FLT_STAGES(flt) ((flt)->stages || load_flt (flt, NULL) == 0) +static FontLayoutCategory * +configure_category (FontLayoutCategory *category, MFLTFont *font) +{ + if (! mflt_font_id || ! mflt_iterate_otf_feature) + { + FontLayoutCategory *new = malloc (sizeof (FontLayoutCategory)); + new->definition = NULL; + new->table = category->table; + M17N_OBJECT_REF (new->table); + return new; + } + return load_category_table (category->definition, font); +} + +static MFLT * +configure_flt (MFLT *flt, MFLTFont *font, MSymbol font_id) +{ + MPlist *plist; + MFLT *configured; + + if (! mflt_font_id || ! mflt_iterate_otf_feature) + return flt; + MPLIST_DO (plist, flt_list) + { + configured = MPLIST_VAL (plist); + if (! configured->font_id) + break; + if (configured->name == flt->name + && configured->font_id == font_id) + return configured; + } + if (! MSTRUCT_CALLOC_SAFE (configured)) + return flt; + *configured = *flt; + configured->stages = mplist_copy (flt->stages); + MPLIST_DO (plist, configured->stages) + { + FontLayoutStage *stage = MPLIST_VAL (plist); + if (stage->category->definition) + { + MSTRUCT_CALLOC (stage, MERROR_FLT); + *stage = *((FontLayoutStage *) MPLIST_VAL (plist)); + stage->category = configure_category (stage->category, font); + MPLIST_VAL (plist) = stage; + } + else + M17N_OBJECT_REF (stage->category->table); + } + configured->need_config = 0; + configured->font_id = font_id; + mplist_push (flt_list, flt->name, configured); + return configured; +} /* Internal API */ @@ -2313,6 +2665,11 @@ m17n_init_flt (void) Mgenerator = msymbol ("generator"); Mend = msymbol ("end"); + mflt_enable_new_feature = 0; + mflt_iterate_otf_feature = NULL; + mflt_font_id = NULL; + mflt_try_otf = NULL; + MDEBUG_PRINT_TIME ("INIT", (stderr, " to initialize the flt modules.")); MDEBUG_POP_TIME (); } @@ -2363,14 +2720,18 @@ MFLT * mflt_get (MSymbol name) { MFLT *flt; + MPlist *plist; if (! flt_list && list_flt () < 0) return NULL; - flt = mplist_get (flt_list, name); + for (plist = flt_list; plist; plist = plist->next) + if (((MFLT *) MPLIST_VAL (plist))->font_id == Mnil) + break; + flt = mplist_get (plist, name); if (! flt || ! CHECK_FLT_STAGES (flt)) return NULL; if (flt->name == Mcombining - && ! mchartable_lookup (flt->coverage, 0)) + && ! mchartable_lookup (flt->coverage->table, 0)) setup_combining_flt (flt); return flt; @@ -2400,7 +2761,7 @@ mflt_get (MSymbol name) MFLT * mflt_find (int c, MFLTFont *font) { - MPlist *plist; + MPlist *plist, *pl; MFLT *flt; static MSymbol unicode_bmp = NULL, unicode_full = NULL; @@ -2412,23 +2773,27 @@ mflt_find (int c, MFLTFont *font) if (! flt_list && list_flt () < 0) return NULL; + /* Skip configured FLTs. */ + MPLIST_DO (plist, flt_list) + if (((MFLT *) MPLIST_VAL (plist))->font_id == Mnil) + break; if (font) { MFLT *best = NULL; - MPLIST_DO (plist, flt_list) + MPLIST_DO (pl, plist) { - flt = MPLIST_VAL (plist); + flt = MPLIST_VAL (pl); if (flt->registry != unicode_bmp && flt->registry != unicode_full) continue; if (flt->family && flt->family != font->family) continue; if (flt->name == Mcombining - && ! mchartable_lookup (flt->coverage, 0)) + && ! mchartable_lookup (flt->coverage->table, 0)) setup_combining_flt (flt); if (c >= 0 - && ! mchartable_lookup (flt->coverage, c)) + && ! mchartable_lookup (flt->coverage->table, c)) continue; if (flt->otf.sym) { @@ -2442,22 +2807,32 @@ mflt_find (int c, MFLTFont *font) } else if (! font->check_otf (font, spec)) continue; - return flt; + goto found; } best = flt; } - return best; + if (best == NULL) + return NULL; + flt = best; + goto found; } if (c >= 0) { - MPLIST_DO (plist, flt_list) + MPLIST_DO (pl, plist) { - flt = MPLIST_VAL (plist); - if (mchartable_lookup (flt->coverage, c)) - return flt; + flt = MPLIST_VAL (pl); + if (mchartable_lookup (flt->coverage->table, c)) + goto found; } } return NULL; + + found: + if (! CHECK_FLT_STAGES (flt)) + return NULL; + if (font && flt->need_config && mflt_font_id) + flt = configure_flt (flt, font, mflt_font_id (font)); + return flt; } /*=*/ @@ -2493,7 +2868,7 @@ mflt_name (MFLT *flt) MCharTable * mflt_coverage (MFLT *flt) { - return flt->coverage; + return flt->coverage->table; } /*=*/ @@ -2547,6 +2922,7 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, int auto_flt = ! flt; int c, i, j, k; int this_from, this_to; + MSymbol font_id = mflt_font_id ? mflt_font_id (font) : Mnil; out = *gstring; out.glyphs = NULL; @@ -2558,9 +2934,12 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, for (i = from; i < to; i++) { g = GREF (gstring, i); - c = g->c; - memset (g, 0, sizeof (MFLTGlyph)); - g->code = g->c = c; + if (! g->encoded) + { + c = g->c; + memset (g, 0, sizeof (MFLTGlyph)); + g->code = g->c = c; + } g->from = g->to = i; } @@ -2569,7 +2948,8 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, if (! auto_flt) { for (this_to = this_from; this_to < to; this_to++) - if (mchartable_lookup (flt->coverage, GREF (gstring, this_to)->c)) + if (mchartable_lookup (flt->coverage->table, + GREF (gstring, this_to)->c)) break; } else @@ -2591,7 +2971,7 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, { c = GREF (gstring, this_to)->c; if (font->internal - && mchartable_lookup (((MFLT *) font->internal)->coverage, c)) + && mchartable_lookup (((MFLT *) font->internal)->coverage->table, c)) { flt = font->internal; break; @@ -2619,9 +2999,18 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, MDEBUG_PRINT1 (" [FLT] (%s", MSYMBOL_NAME (flt->name)); + if (flt->need_config && font_id != Mnil) + flt = configure_flt (flt, font, font_id); + for (; this_to < to; this_to++) - if (! mchartable_lookup (flt->coverage, GREF (gstring, this_to)->c)) - break; + { + char enc; + g = GREF (gstring, this_to); + enc = (int) mchartable_lookup (flt->coverage->table, g->c); + if (! enc) + break; + SET_CATEGORY_CODE (g, enc); + } if (MDEBUG_FLAG ()) { @@ -2698,6 +3087,18 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, return to; } +int mflt_enable_new_feature; + +int (*mflt_iterate_otf_feature) (struct _MFLTFont *font, + MFLTOtfSpec *spec, + int from, int to, + unsigned char *table); + +MSymbol (*mflt_font_id) (struct _MFLTFont *font); + +int (*mflt_try_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *gstring, int from, int to); + /* for debugging... */ @@ -2804,6 +3205,21 @@ mdebug_dump_flt (MFLT *flt, int indent) return flt; } +void +mflt_dump_gstring (MFLTGlyphString *gstring) +{ + int i; + + fprintf (stderr, "(flt-gstring"); + for (i = 0; i < gstring->used; i++) + { + MFLTGlyph *g = GREF (gstring, i); + fprintf (stderr, "\n (%02d pos:%d-%d c:%04X code:%04X cat:%c)", + i, g->from, g->to, g->c, g->code, GET_CATEGORY_CODE (g)); + } + fprintf (stderr, ")\n"); +} + /*** @} */ /* diff --git a/src/m17n-flt.h b/src/m17n-flt.h index 9f53b74..534c227 100644 --- a/src/m17n-flt.h +++ b/src/m17n-flt.h @@ -109,35 +109,39 @@ typedef struct fractional pixel format. */ /***ja ½Ä½ñ¤­»þ¤ÎÁ÷¤ê¹â¤ò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int yadv; + /* @{ */ /***en Ink metrics of the glyph expressed in 26.6 fractional pixel format. */ /***ja ¤³¤Î¥°¥ê¥Õ¤Î¥¤¥ó¥¯¥á¥È¥ê¥Ã¥¯¤ò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int ascent, descent, lbearing, rbearing; + /* @} */ + /* @{ */ /***en Horizontal and vertical adjustments for the glyph positioning expressed in 26.6 fractional pixel format. */ /***ja ¥°¥ê¥Õ°ÌÃÖ·è¤á¤ÎºÝ¤Î¿åÊ¿¡¦¿âľĴÀ°Ãͤò¡¢ 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int xoff, yoff; - /***en Flag to tell whether the member has already been set + /* @} */ + /***en Flag to tell whether the member \ has already been set to a glyph ID in the font. */ - /***ja ¥á¥ó¥Ð¡¼ ¤Ë´û¤Ë¥°¥ê¥Õ ID + /***ja ¥á¥ó¥Ð¡¼ \ ¤Ë´û¤Ë¥°¥ê¥Õ ID ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ë¤«Èݤ«¤ò¼¨¤¹¥Õ¥é¥°¡£ */ unsigned encoded : 1; - /***en Flag to tell if the metrics of the glyph (members thru - ) are already calculated. */ - /***ja ¥á¥ó¥Ð¡¼ ¤«¤é + /***en Flag to tell if the metrics of the glyph (members \ thru + \) are already calculated. */ + /***ja ¥á¥ó¥Ð¡¼ \ ¤«¤é \ ¤Þ¤Ç¤Î³Æ¥á¥È¥ê¥Ã¥¯¤¬´û¤Ë·×»»ºÑ¤«Èݤ«¤ò¼¨¤¹¥Õ¥é¥°¡£ */ unsigned measured : 1; /***en Flag to tell if the metrics of the glyph is adjusted, - i.e. or is different from the normal size, or - or is nonzero. */ + i.e. \ or \ is different from the normal size, or + \ or \ is nonzero. */ /***ja ¥°¥ê¥Õ¤Î¥á¥È¥ê¥Ã¥¯¤¬Ä´À°ºÑ¤ß¤«Èݤ«¡¢ ¤¹¤Ê¤ï¤Á°Ê²¼¤Î¤¦¤Á1¤Ä°Ê¾å¤¬À®Î©¤·¤Æ¤¤¤ë¤³¤È¤ò¼¨¤¹¥Õ¥é¥°¡£ - ¤¬É¸½à¤ÎÃͤȰۤʤ롢 - ¤¬É¸½à¤ÎÃͤȰۤʤ롢 - ¤¬¥¼¥í¤Ç¤Ê¤¤¡¢ - ¤¬¥¼¥í¤Ç¤Ê¤¤¡£ */ + \ ¤¬É¸½à¤ÎÃͤȰۤʤ롢 + \ ¤¬É¸½à¤ÎÃͤȰۤʤ롢 + \ ¤¬¥¼¥í¤Ç¤Ê¤¤¡¢ + \ ¤¬¥¼¥í¤Ç¤Ê¤¤¡£ */ unsigned adjusted : 1; /***en For m17n-lib's internal use only. */ /***ja m17n-lib ÆâÉôºî¶ÈÍÑ¡£ */ @@ -153,35 +157,39 @@ typedef struct The type #MFLTGlyphAdjustment is the structure to store information about a glyph metrics/position adjustment. It is - given to the callback function #drive_otf of #MFLTFont. */ + given to the callback function @b drive_otf of #MFLTFont. */ /***ja @brief ¥°¥ê¥Õ°ÌÃÖÄ´À°¾ðÊó¤Î¤¿¤á¤Î·¿. ·¿ #MFLTGlyphAdjustment ¤Ï¡¢¥°¥ê¥Õ¤Î¥á¥È¥ê¥Ã¥¯/°ÌÃÖ¤ÎÄ´À°¤Ë´Ø¤¹¤ë¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î¹½Â¤ÂΤǤ¢¤ê¡¢ - #MFLTFont ¤Î callback ´Ø¿ô #drive_otf ¤ËÅϤµ¤ì¤ë¡£ */ + #MFLTFont ¤Î callback ´Ø¿ô @b drive_otf ¤ËÅϤµ¤ì¤ë¡£ */ typedef struct { + /* @{ */ /***en Adjustments for advance width for horizontal layout and advance height for vertical layout expressed in 26.6 fractional pixel format. */ /***ja ¿åÊ¿¡¦¿âľÊý¸þ¤ÎÁ÷¤êÎ̤ÎÄ´À°Ãͤò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int xadv, yadv; + /* @} */ + /* @{ */ /***en Horizontal and vertical adjustments for glyph positioning expressed in 26.6 fractional pixel format. */ /***ja ¥°¥ê¥Õ°ÌÃÖ·è¤á¤¿¤á¤Î¿åÊ¿¡¦¿âľĴÀ°Ãͤò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int xoff, yoff; + /* @} */ /***en Number of glyphs to go back for drawing a glyph. */ /***ja ¥°¥ê¥ÕÉÁ²è¤Î¤¿¤á¤ËÌá¤ë¤Ù¤­¥°¥ê¥Õ¿ô¡£ */ short back; - /***en If nonzero, the member and are absolute, i.e., + /***en If nonzero, the member \ and \ are absolute, i.e., they should not be added to a glyph's origianl advance width and height. */ - /***ja Èó¥¼¥í¤Î¤È¤­¡¢¥á¥ó¥Ð¡¼ ¤È ¤ÏÀäÂÐÃͤǤ¢¤ë¡£ + /***ja Èó¥¼¥í¤Î¤È¤­¡¢¥á¥ó¥Ð¡¼ \ ¤È \ ¤ÏÀäÂÐÃͤǤ¢¤ë¡£ ¤¹¤Ê¤ï¤Á¤½¤ÎÃͤò¥°¥ê¥ÕËÜÍè¤ÎÁ÷¤êÉý¤Ë²Ã»»¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */ unsigned advance_is_absolute : 1; /***en Should be set to 1 iff at least one of the other members has @@ -245,25 +253,26 @@ typedef struct typedef struct { /***en Unique symbol representing the spec. This is the same as the - #OTF-SPEC of the FLT. */ + @ref OTF-SPEC of the FLT. */ /***ja ¤³¤Î»ÅÍͤòɽ¤ï¤¹¥æ¥Ë¡¼¥¯¤Ê¥·¥ó¥Ü¥ë¡£ - FLT ¤Î #OTF-SPEC ¤ÈƱ°ì¤ÎÃͤǤ¢¤ë¡£ */ + FLT ¤Î @ref OTF-SPEC ¤ÈƱ°ì¤ÎÃͤǤ¢¤ë¡£ */ MSymbol sym; + /* @{ */ /***en Tags for script and language system. */ /***ja ¥¹¥¯¥ê¥×¥È¤ª¤è¤Ó¸À¸ì¥·¥¹¥Æ¥à¤Î¥¿¥°¡£ */ unsigned int script, langsys; - - /***en Array of GSUB (1st element) and GPOS (2nd element) features. - Each array is terminated by 0. If an element is 0xFFFFFFFF - apply the previous features in that order, and apply all the - other features except those that appear in the following elements. - It may be NULL if there are no features. */ - /***ja GSUB ¥Õ¥£¡¼¥Á¥ã¡¼¤òÂè1Í×ÁÇ¡¢GPOS ¥Õ¥£¡¼¥Á¥ã¡¼¤òÂè2Í×ÁǤȤ¹¤ëÇÛ - Îó¡£³ÆÇÛÎó¤ÎËöÈø¤Ï0¤Ç¼¨¤µ¤ì¤ë¡£¤â¤·¤¢¤ëÍ×ÁǤ¬ 0xFFFFFFFF¤Ê¤é¤Ð¡¢ - °ÊÁ°¤ÎÁ´¥Õ¥£¡¼¥Á¥ã¡¼¤ò¤½¤Î½ç½ø¤ÇŬÍѤ·¡¢¹¹¤Ë°Ê¹ß¤ÎÍ×ÁǤȤ·¤Æ¸½¤ï - ¤ì¤ë¥Õ¥£¥Á¥ã¡¼°Ê³°¤Î¤¹¤Ù¤Æ¤òŬÍѤ¹¤ë¡£¥Õ¥£¡¼¥Á¥ã¡¼¤¬1¤Ä¤â¤Ê¤¤¾ì¹ç - ¤Ï NULL ¤Ç¤â¤è¤¤¡£ */ + /* @} */ + + /***en Array of GSUB (1st element) and GPOS (2nd element) feature + tag arrays. Each array is terminated by 0. If the first + element is 0xFFFFFFFF, apply all the features except those that + appear in the following elements. It may be NULL if there are + no features. */ + /***ja GSUB ¥Õ¥£¡¼¥Á¥ã¡¼¥¿¥°¤ÎÇÛÎó¤òÂè1Í×ÁÇ¡¢GPOS ¥Õ¥£¡¼¥Á¥ã¡¼¥¿¥°¤Î + ÇÛÎó¤òÂè2Í×ÁǤȤ¹¤ëÇÛÎó¡£³ÆÇÛÎó¤ÎËöÈø¤Ï0¤Ç¼¨¤µ¤ì¤ë¡£¤â¤·ºÇ½é¤ÎÍ× + ÁǤ¬ 0xFFFFFFFF¤Ê¤é¤Ð¡¢°Ê¹ß¤ÎÍ×ÁǤȤ·¤Æ¸½¤ï¤ì¤ë¥Õ¥£¥Á¥ã¡¼°Ê³°¤Î¤¹ + ¤Ù¤Æ¤òŬÍѤ¹¤ë¡£¥Õ¥£¡¼¥Á¥ã¡¼¤¬1¤Ä¤â¤Ê¤¤¾ì¹ç¤Ï NULL ¤Ç¤â¤è¤¤¡£ */ unsigned int *features[2]; } MFLTOtfSpec; @@ -273,13 +282,22 @@ typedef struct @brief Type of font to be used by the FLT driver. The type #MFLTFont is the structure that contains information - about a font used by the FLT driver. */ + about a font used by the FLT driver. Usually, an application + should prepare a bigger structure whose first element is MFLTFont + and has more information about the font that is used by callback + funcitons, and give that structure to mflt functions by coercing + it to MFLTFont. It is assured that callback functions can safely + coerce MFLTFont back to the original structure. */ /***ja @brief FLT ¥É¥é¥¤¥Ð¤¬»È¤¦¥Õ¥©¥ó¥È¤Î·¿. ·¿ #MFLTFont ¤Ï¡¢FLT¥É¥é¥¤¥Ð¤¬»È¤¦¥Õ¥©¥ó¥È¤Ë´Ø¤¹¤ë¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿ - ¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£ */ + ¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£Ä̾異¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏºÇ½é¤ÎÍ×ÁǤ¬ MFLTFont ¤Ç¡¢ + »Ä¤ê¤ÎÍ×ÁǤËcallback´Ø¿ô¤¬ÍøÍѤ¹¤ë¥Õ¥©¥ó¥È¾ðÊó¤ò»ý¤Ã¤¿¡¢¤è¤êÂ礭¤Ê + ¹½Â¤ÂΤòÍÑ°Õ¤·¡¢¤½¤ì¤ò MFLTFont ¤Ë coerce ¤·¤Æ mflt ¤Î³Æ´Ø¿ô¤ËÅϤ¹¡£ + ³Æcallback´Ø¿ô¤Ï MFLTFont ¤ò¸µ¤Î¹½Â¤ÂÎ¤Ë coerce ¤·Ä¾¤¹¤³¤È¤¬¤Ç¤­¤ë + ¤³¤È¤¬Êݾڤµ¤ì¤Æ¤¤¤ë¡£ */ typedef struct _MFLTFont { @@ -291,30 +309,33 @@ typedef struct _MFLTFont ¤¤¾ì¹ç (¤¿¤È¤¨¤Ð OpenType¥Õ¥©¥ó¥È¤Î¾ì¹ç¤Ê¤É) ¤Ï¡¢#Mnil ¤Ç¤è¤¤¡£ */ MSymbol family; - /***en Horizontal and vertical font sizes in pixels per EM. */ - /***ja ¥Õ¥©¥ó¥È¤Î¿åÊ¿¡¦¿âľ¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ - int x_ppem, y_ppem; + /***en Horizontal font sizes in pixels per EM. */ + /***ja ¥Õ¥©¥ó¥È¤Î¿åÊ¿¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ + int x_ppem; + /***en Vertical font sizes in pixels per EM. */ + /***ja ¥Õ¥©¥ó¥È¤Î¿âľ¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ + int y_ppem; /***en Callback function to get glyph IDs for glyphs between FROM - (inclusive) and TO (exclusive) of GSTRING. If the member - of a glyph is zero, the member of that glyph is a character + (inclusive) and TO (exclusive) of GSTRING. If the member \ + of a glyph is zero, the member \ of that glyph is a character code. The function must convert it to the glyph ID of FONT. */ /***ja GSTRING Æâ¤Î FROM ¤«¤é TO ľÁ°¤Þ¤Ç¤Î³Æ¥°¥ê¥Õ¤ËÂбþ¤¹¤ë¥°¥ê¥Õ ID¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î callback ´Ø¿ô¡£¤â¤·¤¢¤ë¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ - ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ ¤Ïʸ»ú¥³¡¼¥É¤Ç + \¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ \ ¤Ïʸ»ú¥³¡¼¥É¤Ç ¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï¤½¤Îʸ»ú¥³¡¼¥É¤ò FONT ¤Î¥°¥ê¥Õ ID¤ËÊÑ´¹¤·¤Ê¤¯¤Æ¤Ï ¤Ê¤é¤Ê¤¤¡£ */ int (*get_glyph_id) (struct _MFLTFont *font, MFLTGlyphString *gstring, int from, int to); /***en Callback function to get metrics of glyphs between FROM - (inclusive) and TO (exclusive) of GSTRING. If the member - of a glyph is zero, the function must set the members , , - , , , and of the glyph. */ + (inclusive) and TO (exclusive) of GSTRING. If the member \ + of a glyph is zero, the function must set the members \, \, + \, \, \, and \ of the glyph. */ /***ja GSTRING Æâ¤Î FROM ¤«¤é TOľÁ°¤Þ¤Ç¤Î³Æ¥°¥ê¥Õ¤ËÂбþ¤¹¤ë¥á¥È¥ê¥Ã ¥¯¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î callback ´Ø¿ô¡£¤â¤·¤¢¤ë¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ - ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤³¤Î´Ø¿ô¤Ï¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ , - , , , , ¤ª¤è¤Ó ¤ò¥»¥Ã + \¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤³¤Î´Ø¿ô¤Ï¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ \, + \, \, \, \, ¤ª¤è¤Ó \¤ò¥»¥Ã ¥È¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */ int (*get_metrics) (struct _MFLTFont *font, MFLTGlyphString *gstring, int from, int to); @@ -377,6 +398,18 @@ extern MCharTable *mflt_coverage (MFLT *flt); extern int mflt_run (MFLTGlyphString *gstring, int from, int to, MFLTFont *font, MFLT *flt); +extern int mflt_enable_new_feature; + +extern MSymbol (*mflt_font_id) (MFLTFont *font); + +extern int (*mflt_iterate_otf_feature) (MFLTFont *font, + MFLTOtfSpec *spec, + int from, int to, + unsigned char *table); + +extern int (*mflt_try_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *gstring, int from, int to); + /*=*/ /*** @} */ diff --git a/src/m17n-gui.c b/src/m17n-gui.c index 66b9f2a..e6c7a19 100644 --- a/src/m17n-gui.c +++ b/src/m17n-gui.c @@ -125,9 +125,11 @@ register_device_library (MSymbol name, char *lib) MDeviceLibraryInterface *interface; MSTRUCT_CALLOC (interface, MERROR_WIN); - interface->library = malloc (strlen (lib) + interface->library = malloc (strlen (M17N_MODULE_DIR) + 1 + + strlen (lib) + strlen (DLOPEN_SHLIB_EXT) + 1); - sprintf (interface->library, "%s%s", lib, DLOPEN_SHLIB_EXT); + sprintf (interface->library, "%s/%s%s", M17N_MODULE_DIR, lib, + DLOPEN_SHLIB_EXT); if (! device_library_list) device_library_list = mplist (); mplist_add (device_library_list, name, interface); @@ -372,8 +374,8 @@ m17n_fini_win (void) These are the symbols to use in a parameter to create a frame. See the function mframe () for details. - #Mdevice, #Mdisplay, #Mscreen, #Mdrawable, #Mdepth, and #Mcolormap - are also keys of a frame property. */ + @b Mdevice, @b Mdisplay, @b Mscreen, @b Mdrawable, @b Mdepth, and + @b Mcolormap are also keys of a frame property. */ /***ja @name ÊÑ¿ô¡§ ¥Õ¥ì¡¼¥à¥Ñ¥é¥á¡¼¥¿ÍÑ¥­¡¼ @@ -381,8 +383,8 @@ m17n_fini_win (void) ¥Õ¥ì¡¼¥à¤òÀ¸À®¤¹¤ëºÝ¤Î¥Ñ¥é¥á¡¼¥¿¤ËÍѤ¤¤ë¥·¥ó¥Ü¥ë¡£¾Ü¤·¤¯¤Ï´Ø¿ô mframe () ¤ÎÀâÌÀ»²¾È¡£ - #Mdevice¡¢ #Mdisplay¡¢ #Mscreen¡¢ #Mdrawable¡¢ #Mdepth¡¢#Mcolormap - ¤Ï¥Õ¥ì¡¼¥à¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤Ç¤â¤¢¤ë¡£ */ + @b Mdevice¡¢ @b Mdisplay¡¢ @b Mscreen¡¢ @b Mdrawable¡¢ @b Mdepth¡¢ + @b Mcolormap ¤Ï¥Õ¥ì¡¼¥à¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤Ç¤â¤¢¤ë¡£ */ /*=*/ @@ -425,14 +427,14 @@ MSymbol Mfont_descent;
      -
    • #Mdevice, the value must be one of #Mx, #Mgd, and #Mnil. +
    • @b Mdevice, the value must be one of #Mx, @b Mgd, and #Mnil. If the value is #Mx, the frame is for X Window System. The argument #MDrawWindow specified together with the frame must be of type @c Window. The frame is both readable and writable, thus all GUI functions can be used. - If the value is #Mgd, the frame is for an image object of GD + If the value is @b Mgd, the frame is for an image object of GD library. The argument #MDrawWindow specified together with the frame must be of type @c gdImagePtr. The frame is writable only, thus functions minput_XXX can't be used for the frame. @@ -448,23 +450,23 @@ MSymbol Mfont_descent;
    - In addition, if the value of the key #Mdevice is #Mx, the + In addition, if the value of the key @b Mdevice is #Mx, the following keys are recognized. They are to specify the root window and the depth of drawables that can be used with the frame.
      -
    • #Mdrawable, the value type must be Drawable. +
    • @b Mdrawable, the value type must be Drawable. - A parameter of key #Mdisplay must also be specified. The + A parameter of key @b Mdisplay must also be specified. The created frame can be used for drawables whose root window and depth are the same as those of the specified drawable on the specified display. - When this parameter is specified, the parameter of key #Mscreen + When this parameter is specified, the parameter of key @b Mscreen is ignored. -
    • #Mwidget, the value type must be Widget. +
    • @b Mwidget, the value type must be Widget. The created frame can be used for drawables whose root window and depth are the same as those of the specified widget. @@ -472,34 +474,34 @@ MSymbol Mfont_descent; If a parameter of key #Mface is not specified, the default face is created from the resources of the widget. - When this parameter is specified, the parameters of key #Mdisplay, - #Mscreen, #Mdrawable, #Mdepth are ignored. + When this parameter is specified, the parameters of key @b Mdisplay, + @b Mscreen, @b Mdrawable, @b Mdepth are ignored. -
    • #Mdepth, the value type must be unsigned. +
    • @b Mdepth, the value type must be unsigned. The created frame can be used for drawables of the specified depth. -
    • #Mscreen, the value type must be (Screen *). +
    • @b Mscreen, the value type must be (Screen *). The created frame can be used for drawables whose root window is the same as the root window of the specified screen, and depth is the same at the default depth of the screen. - When this parameter is specified, parameter of key #Mdisplay is + When this parameter is specified, parameter of key @b Mdisplay is ignored. -
    • #Mdisplay, the value type must be (Display *). +
    • @b Mdisplay, the value type must be (Display *). The created frame can be used for drawables whose root window is the same as the root window for the default screen of the display, and depth is the same as the default depth of the screen. -
    • #Mcolormap, the value type must be (Colormap). +
    • @b Mcolormap, the value type must be (Colormap). The created frame uses the specified colormap. -
    • #Mfont, the value must be #Mx, #Mfreetype, or #Mxft. +
    • @b Mfont, the value must be #Mx, #Mfreetype, or #Mxft. The created frame uses the specified font backend. The value #Mx instructs to use X core fonts, #Mfreetype to use local fonts @@ -530,14 +532,14 @@ MSymbol Mfont_descent;
        -
      • #Mdevice. ÃÍ¤Ï #Mx, #Mgd, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ +
      • @b Mdevice. ÃÍ¤Ï #Mx, @b Mgd, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ Ãͤ¬ #Mx ¤Ê¤é¤Ð¡¢¿·¤·¤¤¥Õ¥ì¡¼¥à¤Ï X ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥àÍѤǤ¢¤ë¡£ ¤³¤Î¥Õ¥ì¡¼¥à¤È¶¦¤Ë»ØÄꤵ¤ì¤¿°ú¿ô #MDrawWindow ¤Ï¡¢ @c Window ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¥Õ¥ì¡¼¥à¤ÏÆɤ߽ñ¤­¤È¤â¤Ë²Äǽ¤Ç¤¢¤ê¡¢¤¹¤Ù¤Æ¤ÎGUI ´Ø¿ô¤¬»ÈÍѤǤ­¤ë¡£ - Ãͤ¬ #Mgd ¤Ê¤é¤Ð¡¢¿·¤·¤¤¥Õ¥ì¡¼¥à¤Ï GD + Ãͤ¬ @b Mgd ¤Ê¤é¤Ð¡¢¿·¤·¤¤¥Õ¥ì¡¼¥à¤Ï GD ¥é¥¤¥Ö¥é¥ê¤Î¥¤¥á¡¼¥¸¥ª¥Ö¥¸¥§¥¯¥ÈÍѤǤ¢¤ë¡£¤³¤Î¥Õ¥ì¡¼¥à¤È¶¦¤Ë»ØÄꤵ¤ì¤¿°ú¿ô #MDrawWindow ¤Ï¡¢ @c gdImagePtr ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¥Õ¥ì¡¼¥à¤Ï½ñ¤­½Ð¤·ÀìÍѤǤ¢¤ê¡¢ minput_ ¤Ç»Ï¤Þ¤ë̾Á°¤Î´Ø¿ô¤Ï»ÈÍѤǤ­¤Ê¤¤¡£ @@ -552,21 +554,21 @@ MSymbol Mfont_descent;
      - ¤³¤ì¤é¤Î¥­¡¼¤Ë²Ã¤¨¡¢#Mdevice ¤Î¥­¡¼¤¬ #Mx + ¤³¤ì¤é¤Î¥­¡¼¤Ë²Ã¤¨¡¢@b Mdevice ¤Î¥­¡¼¤¬ #Mx ¤Ç¤¢¤ë¾ì¹ç¤Ë¸Â¤ê°Ê²¼¤Î¥­¡¼¤âǧ¼±¤µ¤ì¤ë¡£°Ê²¼¤Î¥­¡¼¤Ï¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤È¡¢¥Õ¥ì¡¼¥à¤ÇÍøÍѤǤ­¤ë drawable ¤Î¿¼¤µ¤ò»ØÄꤹ¤ë¡£
        -
      • #Mdrawable. ÃÍ¤Ï Drawable ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ +
      • @b Mdrawable. ÃÍ¤Ï Drawable ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ - ¥­¡¼ #Mdisplay ¤ò»ý¤Ä¥Ñ¥é¥á¡¼¥¿¤â»ØÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£ + ¥­¡¼ @b Mdisplay ¤ò»ý¤Ä¥Ñ¥é¥á¡¼¥¿¤â»ØÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£ À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤵ¤ì¤¿¥Ç¥£¥¹¥×¥ì¥¤¾å¤Î»ØÄꤵ¤ì¤¿ drawable ¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤È¿¼¤µ¤ò»ý¤Ä drawable ¤ËÍѤ¤¤é¤ì¤ë¡£ - ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢#Mscreen ¤ò¥­¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ + ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@b Mscreen ¤ò¥­¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ -
      • #Mwidget. ÃÍ¤Ï Widget ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ +
      • @b Mwidget. ÃÍ¤Ï Widget ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥¦¥£¥¸¥§¥Ã¥È¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤È¿¼¤µ¤ò»ý¤Ä drawable ¤ËÍѤ¤¤é¤ì¤ë¡£ @@ -574,24 +576,24 @@ MSymbol Mfont_descent; ¥­¡¼ #Mface ¤ò»ý¤Ä¥Ñ¥é¥á¡¼¥¿¤¬¤Ê¤±¤ì¤Ð¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥§¡¼¥¹¤Ï¤³¤Î ¥¦¥£¥¸¥§¥Ã¥È¤Î¥ê¥½¡¼¥¹¤«¤éºî¤é¤ì¤ë¡£ - ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢#Mdisplay, #Mscreen, #Mdrawable, - #Mdepth ¤ò¥­¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ + ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@b Mdisplay, @b Mscreen, @b Mdrawable, + @b Mdepth ¤ò¥­¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ -
      • #Mdepth. ÃÍ¤Ï unsigned ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ +
      • @b Mdepth. ÃÍ¤Ï unsigned ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¿¼¤µ¤Î drawable ¤ËÍѤ¤¤é¤ì¤ë¡£ -
      • #Mscreen. ÃÍ¤Ï (Screen *) ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ +
      • @b Mscreen. ÃÍ¤Ï (Screen *) ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ À¸À®¤·¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥¹¥¯¥ê¡¼¥ó¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤ò»ý¤Á¡¢¥¹¥¯¥ê¡¼¥ó¤Î¥Ç¥Õ¥©¥ë¥È¤Î¿¼¤µ¤ÈƱ¤¸¿¼¤µ¤ò»ý¤Ä drawable ¤ËÍѤ¤¤é¤ì¤ë¡£ - ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢#Mdisplay ¤ò¥­¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ + ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@b Mdisplay ¤ò¥­¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£ -
      • #Mdisplay. ÃÍ¤Ï (Display *) ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ +
      • @b Mdisplay. ÃÍ¤Ï (Display *) ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥Ç¥£¥¹¥×¥ì¥¤¤Î¥Ç¥Õ¥©¥ë¥È¥¹¥¯¥ê¡¼¥ó¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤ÈƱ¤¸¿¼¤µ¤ò»ý¤Ädrawables ¤ËÍѤ¤¤é¤ì¤ë¡£ -
      • #Mcolormap. ÃÍ¤Ï (Colormap) ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ +
      • @b Mcolormap. ÃÍ¤Ï (Colormap) ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥«¥é¡¼¥Þ¥Ã¥×¤ò»ÈÍѤ¹¤ë¡£ diff --git a/src/m17n-gui.h b/src/m17n-gui.h index 87f619b..4875fe1 100644 --- a/src/m17n-gui.h +++ b/src/m17n-gui.h @@ -396,15 +396,21 @@ typedef struct /***ja ÀþÉý¡Ê¥Ô¥¯¥»¥ëñ°Ì¡Ë. */ unsigned width; + /* @{ */ + /*** Colors of borders. */ MSymbol color_top; MSymbol color_bottom; MSymbol color_left; MSymbol color_right; + /* @} */ + /* @{ */ + /*** Margins */ unsigned inner_hmargin; unsigned inner_vmargin; unsigned outer_hmargin; unsigned outer_vmargin; + /* @} */ } MFaceBoxProp; /*=*/ @@ -512,11 +518,11 @@ typedef struct /***en If nonzero, draw an M-text two-dimensionally, i.e., newlines in M-text breaks lines and the following characters are drawn in - the next line. If is non-NULL, and the function + the next line. If \ is non-NULL, and the function returns nonzero line width, a line longer than that width is also broken. */ /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢M-text ¤ò£²¼¡¸µÅª¤Ë¡¢¤¹¤Ê¤ï¤Á M-text Ãæ¤Î - newline ¤Ç²þ¹Ô¤·¡¢Â³¤¯Ê¸»ú¤Ï¼¡¤Î¹Ô¤Ëɽ¼¨¤¹¤ë¡£¤â¤· ¤¬ + newline ¤Ç²þ¹Ô¤·¡¢Â³¤¯Ê¸»ú¤Ï¼¡¤Î¹Ô¤Ëɽ¼¨¤¹¤ë¡£¤â¤· \ ¤¬ NULL ¤Ç¤Ê¤¯¡¢¤½¤Î´Ø¿ô¤¬ 0 ¤Ç¤Ê¤¤¹ÔÉý¤òÊÖ¤»¤Ð¡¢¤½¤ÎÉý¤è¤êŤ¤¹Ô¤â²þ¹Ô¤µ¤ì¤ë¡£ */ unsigned two_dimensional : 1; @@ -551,23 +557,25 @@ typedef struct /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢¥Õ¥©¥ó¥È¶­³¦¤Ç¤Î¿åÊ¿Êý¸þ¤Î¥°¥ê¥Õ¤Î½Å¤Ê¤ê¤òÈò¤±¤ë¤¿¤á¤Î¥°¥ê¥Õ°ÌÃÖ¤ÎÄ´À°¤ò̵¸ú¤Ë¤¹¤ë¡£ */ unsigned disable_overlapping_adjustment : 1; - /***en If nonzero, the values are minimum line ascent and descent - pixels. */ - /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϹԤΠascent ¤È descent ¤ÎºÇ¾®Ãͤò¼¨¤¹¡£ */ + /***en If nonzero, the values are minimum line ascent pixels. */ + /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϹԤΠascent ¤ÎºÇ¾®Ãͤò¼¨¤¹¡£ */ unsigned int min_line_ascent; + /***en If nonzero, the values are minimum line descent pixels. */ + /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϹԤΠdescent ¤ÎºÇ¾®Ãͤò¼¨¤¹¡£ */ unsigned int min_line_descent; - /***en If nonzero, the values are maximum line ascent and descent - pixels. */ - /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϹԤΠascent ¤È descent ¤ÎºÇÂçÃͤò¼¨¤¹¡£ */ + /***en If nonzero, the values are maximum line ascent pixels. */ + /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϹԤΠascent ¤ÎºÇÂçÃͤò¼¨¤¹¡£ */ unsigned int max_line_ascent; + /***en If nonzero, the values are maximum line descent pixels. */ + /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϹԤΠdescent ¤ÎºÇÂçÃͤò¼¨¤¹¡£ */ unsigned int max_line_descent; /***en If nonzero, the value specifies how many pixels each line can occupy on the display. The value zero means that there is no - limit. It is ignored if is non-NULL. */ + limit. It is ignored if \ is non-NULL. */ /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϤ³¤Î¥Ç¥£¥¹¥×¥ì¥¤¾å¤Ç³Æ¹Ô¤¬Àê¤á¤ë¤³¤È¤Î¤Ç¤­¤ë¥Ô¥¯¥»¥ë¿ô¤ò¼¨¤¹¡£ - 0 ¤Ï¸ÂÄꤵ¤ì¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ ¤¬ NULL ¤Ç¤Ê¤±¤ì¤Ð̵»ë¤µ¤ì¤ë¡£ */ + 0 ¤Ï¸ÂÄꤵ¤ì¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£\ ¤¬ NULL ¤Ç¤Ê¤±¤ì¤Ð̵»ë¤µ¤ì¤ë¡£ */ unsigned int max_line_width; /***en If nonzero, the value specifies the distance between tab @@ -587,7 +595,7 @@ typedef struct The indentation specifies how many pixels the first glyph of each line is shifted to the right (if the member - is zero) or to the left (otherwise). If + \ is zero) or to the left (otherwise). If the value is negative, each line is shifted to the reverse direction. @@ -598,13 +606,13 @@ typedef struct character, and incremented each time when a long line is broken because of the width limit. - This has an effect only when is nonzero. */ + This has an effect only when \ is nonzero. */ /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢Ãͤϴؿô¤Ç¤¢¤ê¡¢¤½¤Î´Ø¿ô¤Ï¹ÔÈÖ¹æ LINE ¤ÈºÂɸ Y ¤Ë´ð¤Å¤¤¤Æ³Æ¹Ô¤Î¥¤¥ó¥Ç¥ó¥È¤ÈºÇÂçÉý¤ò·×»»¤·¡¢¤½¤ì¤¾¤ì¤òINDENT ¤È WIDTH ¤Ç»Ø¤µ¤ì¤ë¾ì½ê¤ËÊݸ¤¹¤ë¡£ ¥¤¥ó¥Ç¥ó¥È¤Ï¡¢³Æ¹Ô¤ÎºÇ½é¤Î¥°¥ê¥Õ¤ò±¦¡Ê¥á¥ó¥Ð - ¤¬ 0 + \ ¤¬ 0 ¤Î»þ¡Ë¤¢¤ë¤¤¤Ïº¸¡Ê¤½¤ì°Ê³°¤Î»þ¡Ë¤Ë²¿¥Ô¥¯¥»¥ë¤º¤é¤¹¤«¤ò»ØÄꤹ¤ë¡£Ãͤ¬Éé¤Ê¤é¤ÐµÕÊý¸þ¤Ë¤º¤é¤¹¡£ ºÇÂçÉý¤Ï¡¢³Æ¹Ô¤¬¥Ç¥£¥¹¥×¥ì¥¤¾å¤ÇÀê¤á¤ë¤³¤È¤Î¤Ç¤­¤ë¥Ô¥¯¥»¥ë¿ô¤ÎºÇÂçÃͤǤ¢¤ë¡£Ãͤ¬ @@ -613,7 +621,7 @@ typedef struct LINE ¤È Y ¤Ï²þ¹Ôʸ»ú¤Ë¤è¤Ã¤Æ¹Ô¤¬²þ¤Þ¤Ã¤¿ºÝ¤Ë¤Ï 0 ¤Ë¥ê¥»¥Ã¥È¤µ¤ì¡¢Ä¹¤¤¹Ô¤¬ºÇÂçÉý¤ÎÀ©¸Â¤Ë¤è¤Ã¤Æ²þ¹Ô¤µ¤ì¤ë¤¿¤Ó¤Ë 1 Áý¤ä¤µ¤ì¤ë¡£ - ¤³¤ì¤Ï ¤¬ 0 ¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Î¤ßÍ­¸ú¤Ç¤¢¤ë¡£ */ + ¤³¤ì¤Ï \ ¤¬ 0 ¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Î¤ßÍ­¸ú¤Ç¤¢¤ë¡£ */ void (*format) (int line, int y, int *indent, int *width); /***en If non-NULL, the value is a function that calculates a line @@ -622,7 +630,7 @@ typedef struct last one that fits within the limit. FROM is the position of the first character of the line, and TO is the position of the last character displayed on the line if there were not width limit. - LINE and Y are the same as the arguments to . + LINE and Y are the same as the arguments to \. The function must return a character position to break the line. @@ -635,7 +643,7 @@ typedef struct POS ¤ÏºÇÂçÉý¤Ë¼ý¤Þ¤ëºÇ¸å¤Îʸ»ú¤Î¼¡¤Îʸ»ú¤Î°ÌÃ֤Ǥ¢¤ë¡£FROM ¤Ï¹Ô¤ÎºÇ½é¤Îʸ»ú¤Î°ÌÃÖ¡¢TO ¤ÏºÇÂçÉý¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤½¤Î¹Ô¤Ëɽ¼¨¤µ¤ì¤ëºÇ¸å¤Îʸ»ú¤Î°ÌÃ֤Ǥ¢¤ë¡£LINE - ¤È Y ¤Ï ¤Î°ú¿ô¤ÈƱÍͤǤ¢¤ë¡£ + ¤È Y ¤Ï \ ¤Î°ú¿ô¤ÈƱÍͤǤ¢¤ë¡£ ¤³¤Î´Ø¿ô¤Ï¹Ô¤ò²þ¤á¤ëʸ»ú°ÌÃÖ¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¤Þ¤¿ MT ¤òÊѹ¹¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ @@ -643,34 +651,36 @@ typedef struct ¤Ï¡¢¶õÇò¤ò¸ì¤Î¶èÀÚ¤ê¤È¤·¤ÆÍѤ¤¤ë¥¹¥¯¥ê¥×¥ÈÍѤȤ·¤ÆÍ­ÍѤǤ¢¤ë¡£ */ int (*line_break) (MText *mt, int pos, int from, int to, int line, int y); + /***en If nonzero, show the cursor according to \. */ + /***ja ¥¼¥í¤Ç¤Ê¤±¤ì¤Ð \ ¤Ë¤·¤¿¤¬¤Ã¤Æ¥«¡¼¥½¥ë¤òɽ¼¨¤¹¤ë¡£ */ int with_cursor; /***en Specifies the character position to display a cursor. If it is greater than the maximum character position, the cursor is displayed next to the last character of an M-text. If the value - is negative, even if is nonzero, cursor is not + is negative, even if \ is nonzero, cursor is not displayed. */ /***ja ¥«¡¼¥½¥ë¤òɽ¼¨¤¹¤ëʸ»ú°ÌÃÖ¤ò¼¨¤¹¡£ºÇÂç¤Îʸ»ú°ÌÃÖ¤è¤êÂ礭¤±¤ì¤Ð¡¢¥«¡¼¥½¥ë¤Ï M-text ¤ÎºÇ¸å¤Îʸ»ú¤ÎÎÙ¤Ëɽ¼¨¤µ¤ì¤ë¡£Éé¤Ê¤é¤Ð¡¢ - ¤¬ 0 ¤Ç¤Ê¤¯¤Æ¤â¥«¡¼¥½¥ë¤Ïɽ¼¨¤µ¤ì¤Ê¤¤¡£ + \ ¤¬ 0 ¤Ç¤Ê¤¯¤Æ¤â¥«¡¼¥½¥ë¤Ïɽ¼¨¤µ¤ì¤Ê¤¤¡£ */ int cursor_pos; /***en If nonzero, display a cursor at the character position - . If the value is positive, it is the pixel width + \. If the value is positive, it is the pixel width of the cursor. If the value is negative, the cursor width is the same as the underlining glyph(s). */ - /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ ¤Ë¥«¡¼¥½¥ë¤òɽ¼¨¤¹¤ë¡£ + /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢\ ¤Ë¥«¡¼¥½¥ë¤òɽ¼¨¤¹¤ë¡£ Ãͤ¬Àµ¤Ê¤é¤Ð¡¢¥«¡¼¥½¥ë¤ÎÉý¤Ï¤½¤ÎÃÍ¡Ê¥Ô¥¯¥»¥ëñ°Ì¡Ë¤Ç¤¢¤ë¡£ Éé¤Ê¤é¤Ð¡¢¥«¡¼¥½¥ë¤Î¤¢¤ë¥°¥ê¥Õ¤ÈƱ¤¸Éý¤Ç¤¢¤ë¡£ */ int cursor_width; - /***en If nonzero and is also nonzero, display double - bar cursors; at the character position and at the + /***en If nonzero and \ is also nonzero, display double + bar cursors; at the character position \ and at the logically previous character. Both cursors have one pixel width with horizontal fringes at upper or lower positions. */ - /***ja If 0 ¤Ç¤Ê¤¯¡¢¤«¤Ä ¤â 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢¥Ð¡¼¥«¡¼¥½¥ë¤òʸ»ú°ÌÃÖ - ¤ÈÏÀÍýŪ¤Ë¤½¤ì¤ÎÁ°¤Ë¤¢¤ëʸ»ú¤Î£²¥ö½ê¤Ëɽ¼¨¤¹¤ë¡£ + /***ja If 0 ¤Ç¤Ê¤¯¡¢¤«¤Ä \ ¤â 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢¥Ð¡¼¥«¡¼¥½¥ë¤òʸ»ú°ÌÃÖ + \ ¤ÈÏÀÍýŪ¤Ë¤½¤ì¤ÎÁ°¤Ë¤¢¤ëʸ»ú¤Î£²¥ö½ê¤Ëɽ¼¨¤¹¤ë¡£ ÁÐÊý¤È¤â£±¥Ô¥¯¥»¥ëÉý¤Ç¡¢¾å¤«²¼¤Ë¿åÊ¿¤Î¾þ¤ê¤¬¤Ä¤¯¡£*/ int cursor_bidi; @@ -698,7 +708,8 @@ typedef struct */ int disable_caching; - /* If non-NULL, limit the drawing effect to the specified region. */ + /***en If non-NULL, limit the drawing effect to the specified region. */ + /***ja NULL ¤Ç¤Ê¤±¤ì¤Ðɽ¼¨¥¨¥ê¥¢¤ò»ØÄꤵ¤ì¤¿Îΰè¤Ë¸ÂÄꤹ¤ë¡£ */ MDrawRegion clip_region; } MDrawControl; @@ -721,8 +732,14 @@ extern int mdraw_line_break_option; ¤Þ¤¿¡¢É½¼¨¥Ç¥Ð¥¤¥¹¤Î¶ë·ÁÎΰè¤òɽ¤¹¤Î¤Ë¤âÍѤ¤¤é¤ì¤ë¡£ */ typedef struct { - int x, y; - unsigned int width, height; + /*** X coordinates of a glyph or a text. */ + int x; + /*** Y coordinates of a glyph or a text. */ + int y; + /*** Pixel width of a glyph or a text. */ + unsigned int width; + /*** Pixel height of a glyph or a text. */ + unsigned int height; } MDrawMetric; /*=*/ @@ -741,17 +758,27 @@ typedef struct { typedef struct { - /***en Character range corresponding to the glyph. */ - /***ja ¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï. */ - int from, to; - - /***en Character ranges corresponding to the line of the glyph. */ - /***ja ¥°¥ê¥Õ¤ÎÎó¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï. */ - int line_from, line_to; - - /***en X/Y coordinates of the glyph. */ - /***ja ¥°¥ê¥Õ¤Î X/Y ºÂɸ. */ - int x, y; + /***en Start position of character range corresponding to the glyph. */ + /***ja ¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤγ«»Ï°ÌÃÖ. */ + int from; + + /***en End position of character range corresponding to the glyph. */ + /***ja ¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤνªÎ»°ÌÃÖ. */ + int to; + + /***en Start position of character range corresponding to the line of the glyph. */ + /***ja °ì¹Ô¤Î¥°¥ê¥Õ¤ÎÎó¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤγ«»Ï°ÌÃÖ. */ + int line_from; + /***en End position of character range corresponding to the line of the glyph. */ + /***ja °ì¹Ô¤Î¥°¥ê¥Õ¤ÎÎó¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤνªÎ»°ÌÃÖ. */ + int line_to; + + /***en X coordinates of the glyph. */ + /***ja ¥°¥ê¥Õ¤Î X ºÂɸ. */ + int x; + /***en Y coordinates of the glyph. */ + /***ja ¥°¥ê¥Õ¤Î Y ºÂɸ. */ + int y; /***en Metric of the glyph. */ /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡. */ @@ -763,20 +790,35 @@ typedef struct MFont *font; - /***en Character ranges corresponding to logically previous and next - glyphs. Note that we do not need the members prev_to and - next_from because they must be the same as the members from and - to respectively. */ - /***ja ÏÀÍýŪ¤ÊÁ°¸å¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï¡£¥á¥ó¥Ð prev_to ¤È - next_from ¤Ï¡¢¤½¤ì¤¾¤ì¥á¥ó¥Ð from ¤È to ¤ÈƱ¤¸¤Ç¤¢¤ë¤Ï¤º¤Ê¤Î¤ÇÉÔ - ÍפǤ¢¤ë¡£ */ - int prev_from, next_to; - - /***en Character ranges corresponding to visually left and right - glyphs. */ - /***ja ɽ¼¨¾å¤Îº¸±¦¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï¡£ */ - int left_from, left_to; - int right_from, right_to; + /***en Character ranges corresponding to logically previous glyphs. + Note that we do not need the members prev_to because it must + be the same as the member \. */ + /***ja ÏÀÍýŪ¤ÊÁ°¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï¡£¥á¥ó¥Ð prev_to ¤Ï¡¢¥á + ¥ó¥Ð from ¤ÈƱ¤¸¤Ç¤¢¤ë¤Ï¤º¤Ê¤Î¤ÇÉÔÍפǤ¢¤ë¡£ */ + int prev_from; + /***en Character ranges corresponding to logically next glyphs. + Note that we do not need the members next_from because it must + be the same as the member \ respectively. */ + /***ja ÏÀÍýŪ¤Ê¸å¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï¡£¥á¥ó¥Ð next_from ¤Ï + ¥á¥ó¥Ð to ¤ÈƱ¤¸¤Ç¤¢¤ë¤Ï¤º¤Ê¤Î¤ÇÉÔÍפǤ¢¤ë¡£ */ + int next_to; + + /***en Start position of character ranges corresponding to visually + left glyphs. */ + /***ja ɽ¼¨¾å¤Îº¸¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤγ«»Ï°ÌÃÖ¡£ */ + int left_from; + /***en End position of character ranges corresponding to visually + left glyphs. */ + /***ja ɽ¼¨¾å¤Îº¸¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤνªÎ»°ÌÃÖ¡£ */ + int left_to; + /***en Start position of character ranges corresponding to visually + right glyphs. */ + /***ja ɽ¼¨¾å¤Î±¦¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤγ«»Ï°ÌÃÖ¡£ */ + int right_from; + /***en End position of character ranges corresponding to visually + left glyphs. */ + /***ja ɽ¼¨¾å¤Î±¦¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈϰϤνªÎ»°ÌÃÖ¡£ */ + int right_to; /***en Logical width of the glyph. Nominal distance to the next glyph. */ @@ -801,9 +843,11 @@ typedef struct typedef struct { + /* @{ */ /***en Character range corresponding to the glyph. */ /***ja ¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï. */ int from, to; + /* @} */ /***en Font glyph code of the glyph. */ /***ja ¥Õ¥©¥ó¥ÈÆâ¤Î¥°¥ê¥Õ¥³¡¼¥É¡£ */ @@ -812,15 +856,31 @@ typedef struct /***en Logical width of the glyph. Nominal distance to the next glyph. */ /***ja ¥°¥ê¥Õ¤ÎÏÀÍýŪÉý¡£¼¡¤Î¥°¥ê¥Õ¤È¤Î̾Ìܾå¤Îµ÷Î¥¡£ */ - int x_advance, y_advance; - - /***en X/Y offset relative to the glyph position. */ - /***ja ¥°¥ê¥Õ¤Î°ÌÃÖ¤ËÂФ¹¤ë X/Y ¥ª¥Õ¥»¥Ã¥È. */ - int x_off, y_off; - - /***en Metric of the glyph. */ - /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡. */ - int lbearing, rbearing, ascent, descent; + int x_advance; + /***en Logical height of the glyph. Nominal distance to the next + glyph. */ + /***ja ¥°¥ê¥Õ¤ÎÏÀÍýŪ¹â¤µ¡£¼¡¤Î¥°¥ê¥Õ¤È¤Î̾Ìܾå¤Îµ÷Î¥¡£ */ + int y_advance; + + /***en X offset relative to the glyph position. */ + /***ja ¥°¥ê¥Õ¤Î°ÌÃÖ¤ËÂФ¹¤ë X ¥ª¥Õ¥»¥Ã¥È. */ + int x_off; + /***en Y offset relative to the glyph position. */ + /***ja ¥°¥ê¥Õ¤Î°ÌÃÖ¤ËÂФ¹¤ë Y ¥ª¥Õ¥»¥Ã¥È. */ + int y_off; + + /***en Metric of the glyph (left-bearing). */ + /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡ (left-bearing). */ + int lbearing; + /***en Metric of the glyph (right-bearing). */ + /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡ (right-bearing). */ + int rbearing; + /***en Metric of the glyph (ascent). */ + /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡ (ascent). */ + int ascent; + /***en Metric of the glyph (descent). */ + /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡ (descent). */ + int descent; /***en Font used for the glyph. Set to NULL if no font is found for the glyph. */ @@ -832,10 +892,10 @@ typedef struct MSymbol font_type; /***en Pointer to the font structure. The actual type is - (XFontStruct *) if member is Mx, FT_Face if - member is Mfreetype, and (XftFont *) if + (XFontStruct *) if \ member is Mx, FT_Face if + \ member is Mfreetype, and (XftFont *) if \ member is Mxft. */ - /***ja ¥Õ¥©¥ó¥È¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¡£¼ÂºÝ¤Î·¿¤Ï ¥á¥ó¥Ð¤¬ + /***ja ¥Õ¥©¥ó¥È¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¡£¼ÂºÝ¤Î·¿¤Ï \ ¥á¥ó¥Ð¤¬ Mx ¤Ê¤é (XFontStruct *)¡¢ Mfreetype ¤Ê¤é FT_Face¡¢Mxft ¤Ê¤é (XftFont *)¡£ */ void *fontp; @@ -872,15 +932,15 @@ typedef struct /***en Pointer to a face object. Each property of the face, if not Mnil, overrides the same property of face(s) specified as a text - property in . */ + property in \. */ /***ja ¥Õ¥§¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¡£¥Õ¥§¡¼¥¹¤Î³Æ¥×¥í¥Ñ¥Æ¥£¤Ï - Mnil ¤Ç¤Ê¤±¤ì¤Ð ¤Ç»ØÄꤵ¤ì¤¿¥Õ¥§¡¼¥¹¤ÎƱ¤¸¥×¥í¥Ñ¥Æ¥£¤ËÍ¥À褹¤ë*/ + Mnil ¤Ç¤Ê¤±¤ì¤Ð \ ¤Ç»ØÄꤵ¤ì¤¿¥Õ¥§¡¼¥¹¤ÎƱ¤¸¥×¥í¥Ñ¥Æ¥£¤ËÍ¥À褹¤ë*/ MFace *face; - /***en Pointer to a draw control object. The M-text is drawn + /***en Pointer to a draw control object. The M-text \ is drawn by mdraw_text_with_control () with this control object. */ /***ja ɽ¼¨À©¸æ¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¡£ mdraw_text_with_control () - ¤Ï¤³¤Î¥ª¥Ö¥¸¥§¥¯¥È¤òÍѤ¤¤Æ M-text ¤òɽ¼¨¤¹¤ë¡£ */ + ¤Ï¤³¤Î¥ª¥Ö¥¸¥§¥¯¥È¤òÍѤ¤¤Æ M-text \ ¤òɽ¼¨¤¹¤ë¡£ */ MDrawControl *control; } MDrawTextItem; diff --git a/src/m17n.h b/src/m17n.h index ecfcd46..159e237 100644 --- a/src/m17n.h +++ b/src/m17n.h @@ -679,7 +679,7 @@ typedef struct ending by them. On encoding, produce byte sequence according to @c endian with heading BOM. - If is 8, the value has no meaning. */ + If \ is 8, the value has no meaning. */ /***ja ÀèƬ¤Î BOM (¥Ð¥¤¥È¥ª¡¼¥À¡¼¥Þ¡¼¥¯) ¤Î¼è¤ê°·¤¤¤ò»ØÄꤹ¤ë¡£ÃÍ¤Ï 0, @@ -702,12 +702,12 @@ typedef struct Specify the endian type. The value must be 0 or 1. 0 means little endian, and 1 means big endian. - If is 8, the value has no meaning. */ + If \ is 8, the value has no meaning. */ /***ja ¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥¿¥¤¥×¤ò»ØÄꤹ¤ë¡£ÃÍ¤Ï 0 ¤« 1 ¤Ç¤¢¤ê¡¢0 ¤Ê¤é¤Ð¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¡¢1 ¤Ê¤é¤Ð¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£ - ¤¬ 8 ¤Î¾ì¹ç¤Ë¤Ï¡¢¤³¤ÎÃͤϰÕÌ£¤ò»ý¤¿¤Ê¤¤¡£ + \ ¤¬ 8 ¤Î¾ì¹ç¤Ë¤Ï¡¢¤³¤ÎÃͤϰÕÌ£¤ò»ý¤¿¤Ê¤¤¡£ */ int endian; } MCodingInfoUTF; @@ -853,22 +853,28 @@ extern MText *mtext_toupper (MText *mt); /*** @addtogroup m17nInputMethod @{ */ - +/*=*/ /* Struct forward declaration. */ +/*** + @brief See struct MInputMethod */ typedef struct MInputMethod MInputMethod; +/*=*/ +/*** + @brief See struct MInputContext */ typedef struct MInputContext MInputContext; +/*=*/ /***en @brief Type of input method callback functions. This is the type of callback functions called from input method - drivers. #IC is a pointer to an input context, #COMMAND is a name + drivers. $IC is a pointer to an input context, $COMMAND is a name of callback for which the function is called. */ /***ja @brief ÆþÎϥ᥽¥Ã¥É¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î·¿Àë¸À. - ÆþÎϥ᥽¥Ã¥É¤«¤é¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£#IC - ¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¡¢#COMMAND ¤Ï´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤Î̾Á°¤Ç¤¢¤ë¡£ */ + ÆþÎϥ᥽¥Ã¥É¤«¤é¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£$IC + ¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¡¢$COMMAND ¤Ï´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤Î̾Á°¤Ç¤¢¤ë¡£ */ typedef void (*MInputCallbackFunc) (MInputContext *ic, MSymbol command); /*=*/ @@ -890,7 +896,7 @@ typedef struct MInputDriver @brief Open an input method. This function opens the input method $IM. It is called from the - function minput_open_im () after all member of $IM but + function minput_open_im () after all member of $IM but \ set. If opening $IM succeeds, it returns 0. Otherwise, it returns -1. The function can setup $IM->info to keep various information that is referred by the other driver functions. */ @@ -898,7 +904,7 @@ typedef struct MInputDriver /***ja @brief ÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë. - ¤³¤Î´Ø¿ô¤Ï¡¢ÆþÎϥ᥽¥Ã¥É $IM ¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£$IM ¤Î + ¤³¤Î´Ø¿ô¤Ï¡¢ÆþÎϥ᥽¥Ã¥É $IM ¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£$IM ¤Î \ °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô minput_open_im () ¤«¤é¸Æ¤Ð¤ì¤ë¡£$IM ¤ò¥ª¡¼¥×¥ó¤Ç¤­¤ì¤Ð 0 ¤ò¡¢¤Ç¤­¤Ê¤±¤ì¤Ð -1¤òÊÖ¤¹¡£ ¤³¤Î´Ø¿ô¤Ï $IM->info @@ -933,7 +939,7 @@ typedef struct MInputDriver This function creates the input context $IC. It is called from the function minput_create_ic () after all members of $IC but - are set. If creating $IC succeeds, it returns 0. + \ are set. If creating $IC succeeds, it returns 0. Otherwise, it returns -1. The function can setup $IC->info to keep various information that is referred by the other driver functions. */ @@ -942,7 +948,7 @@ typedef struct MInputDriver @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÀ¸À®¤¹¤ë. ¤³¤Î´Ø¿ô¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤òÀ¸À®¤¹¤ë¡£ - $IC ¤Î °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô + $IC ¤Î \ °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô minput_create_ic () ¤«¤é¸Æ¤Ð¤ì¤ë¡£ $IC ¤òÀ¸À®¤Ç¤­¤ì¤Ð 0 ¤ò¡¢¤Ç¤­¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤¹¡£ ¤³¤Î´Ø¿ô¤Ï $IC->info ¤òÀßÄꤷ¤Æ¡¢Â¾¤Î¥É¥é¥¤¥Ð´Ø¿ô¤«¤é»²¾È¤µ¤ì¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ */ @@ -982,7 +988,7 @@ typedef struct MInputDriver It may update $IC->status, $IC->preedit, $IC->cursor_pos, $IC->ncandidates, $IC->candidates, and $IC->produced if that is - necessary for the member . + necessary for the member \. The meaning of $ARG depends on the input method river. See the documentation of @c minput_default_driver and @c @@ -998,7 +1004,7 @@ typedef struct MInputDriver ¤¬ÆþÎϥ᥽¥Ã¥É¤ËµÛ¼ý¤µ¤ì¤Æ¥Æ¥­¥¹¥È¤¬À¸À®¤µ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢ 1 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤òÊÖ¤¹¡£ - ¥á¥ó¥Ð ¤ËɬÍפǤ¢¤ì¤Ð¡¢$IC->status, $IC->preedit, + ¥á¥ó¥Ð \ ¤ËɬÍפǤ¢¤ì¤Ð¡¢$IC->status, $IC->preedit, $IC->cursor_pos, $IC->ncandidates, $IC->candidates, $IC->produced ¤ò¹¹¿·¤Ç¤­¤ë¡£ @@ -1039,31 +1045,34 @@ typedef struct MInputDriver @brief List of callback functions. List of callback functions. Keys are one of - #Minput_preedit_start, #Minput_preedit_draw, - #Minput_preedit_done, #Minput_status_start, #Minput_status_draw, - #Minput_status_done, #Minput_candidates_start, - #Minput_candidates_draw, #Minput_candidates_done, - #Minput_set_spot, #Minput_toggle, #Minput_reset, - #Minput_get_surrounding_text, #Minput_delete_surrounding_text. + @b Minput_preedit_start, @b Minput_preedit_draw, + @b Minput_preedit_done, @b Minput_status_start, @b Minput_status_draw, + @b Minput_status_done, @b Minput_candidates_start, + @b Minput_candidates_draw, @b Minput_candidates_done, + @b Minput_set_spot, @b Minput_toggle, @b Minput_reset, + @b Minput_get_surrounding_text, @b Minput_delete_surrounding_text. Values are functions of type #MInputCallbackFunc. */ /***ja @brief ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î¥ê¥¹¥È. ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î¥ê¥¹¥È¡£¥­¡¼¤Ï¼¡¤Î¤¤¤º¤ì¤«¡£ - #Minput_preedit_start, #Minput_preedit_draw, - #Minput_preedit_done, #Minput_status_start, #Minput_status_draw, - #Minput_status_done, #Minput_candidates_start, - #Minput_candidates_draw, #Minput_candidates_done, - #Minput_set_spot, #Minput_toggle, #Minput_reset, - #Minput_get_surrounding_text, #Minput_delete_surrounding_text¡£ + @b Minput_preedit_start, @b Minput_preedit_draw, + @b Minput_preedit_done, @b Minput_status_start, @b Minput_status_draw, + @b Minput_status_done, @b Minput_candidates_start, + @b Minput_candidates_draw, @b Minput_candidates_done, + @b Minput_set_spot, @b Minput_toggle, @b Minput_reset, + @b Minput_get_surrounding_text, @b Minput_delete_surrounding_text¡£ ÃͤÏ#MInputCallbackFunc ·¿¤Î´Ø¿ô¡£ */ MPlist *callback_list; } MInputDriver; /*=*/ +/*** @} */ +/*=*/ extern MInputDriver minput_default_driver; +extern MSymbol Minput_method; extern MSymbol Minput_driver; extern MInputDriver *minput_driver; @@ -1094,6 +1103,9 @@ extern MSymbol Minherited; extern MSymbol Mcustomized; extern MSymbol Mconfigured; +/*** @addtogroup m17nInputMethod + @{ */ +/*=*/ /***en @brief Structure of input method. @@ -1127,9 +1139,9 @@ struct MInputMethod /***ja minput_open_im () ¤ËÅϤµ¤ì¤ë°ú¿ô¡£ */ void *arg; - /***en Pointer to extra information that .open_im () + /***en Pointer to extra information that \.open_im () setups. */ - /***ja .open_im () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£ */ + /***ja \.open_im () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£ */ void *info; }; @@ -1208,23 +1220,23 @@ struct MInputContext /***ja ¥¹¥Ý¥Ã¥È¾å¤Î M-text¡¢¤Þ¤¿¤Ï NULL. */ MText *mt; - /***en Character position in at the spot. */ - /***ja ¤Ë¤ª¤±¤ë¥¹¥Ý¥Ã¥È¤Îʸ»ú°ÌÃÖ. */ + /***en Character position in \ at the spot. */ + /***ja \ ¤Ë¤ª¤±¤ë¥¹¥Ý¥Ã¥È¤Îʸ»ú°ÌÃÖ. */ int pos; } spot; /***en The usage of the following members depends on the input method driver. The descriptions below are for the driver of an internal input method. They are set by the function - ->driver.filter (). */ + \->driver.filter (). */ /***ja °Ê²¼¤Î¥á¥ó¥Ð¤Î»ÈÍÑË¡¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë¡£ °Ê²¼¤ÎÀâÌÀ¤Ï¡¢ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѤÎÆþÎϥɥ饤¥Ð¤ËÂФ¹¤ë¤â¤Î¤Ç¤¢¤ë¡£ - ¤³¤ì¤é¤Ï´Ø¿ô ->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£ */ + ¤³¤ì¤é¤Ï´Ø¿ô \->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£ */ - /***en Pointer to extra information that ->driver.create_ic () + /***en Pointer to extra information that \->driver.create_ic () setups. It is used to record the internal state of the input context. */ - /***ja ->driver.create_ic () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£ + /***ja \->driver.create_ic () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£ ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÆâÉô¾õÂÖ¤òµ­Ï¿¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë¡£ */ void *info; @@ -1233,31 +1245,31 @@ struct MInputContext /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¸½ºß¤Î¾õÂÖ¤òɽ¤¹ M-text */ MText *status; - /***en The function ->driver.filter () sets the value to 1 when - it changes . */ - /***ja ´Ø¿ô ->driver.filter () ¤Ï¡¢ ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 1 + /***en The function \->driver.filter () sets the value to 1 when + it changes \. */ + /***ja ´Ø¿ô \->driver.filter () ¤Ï¡¢\ ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 1 ¤ËÀßÄꤹ¤ë¡£ */ int status_changed; /***en M-text containing the current preedit text. The function - ->driver.filter () sets the value. */ + \->driver.filter () sets the value. */ /***ja ¸½ºß¤Î preedit ¥Æ¥­¥¹¥È¤ò´Þ¤à M-text¡£´Ø¿ô - ->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£ */ + \->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£ */ MText *preedit; - /***en The function ->driver.filter () sets the value to 1 when - it changes . */ - /***ja ´Ø¿ô ->driver.filter () ¤Ï¡¢ ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò + /***en The function \->driver.filter () sets the value to 1 when + it changes \. */ + /***ja ´Ø¿ô \->driver.filter () ¤Ï¡¢\ ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 1 ¤ËÀßÄꤹ¤ë¡£ */ int preedit_changed; - /***en Cursor position of . */ - /***ja ¤Î¥«¡¼¥½¥ë°ÌÃÖ */ + /***en Cursor position of \. */ + /***ja \¤Î¥«¡¼¥½¥ë°ÌÃÖ */ int cursor_pos; - /***en The function ->driver.filter () sets the value to 1 when - it changes . */ - /***ja ´Ø¿ô ->driver.filter () ¤Ï¡¢ ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò + /***en The function \->driver.filter () sets the value to 1 when + it changes \. */ + /***ja ´Ø¿ô \->driver.filter () ¤Ï¡¢\ ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 1 ¤ËÀßÄꤹ¤ë¡£ */ int cursor_pos_changed; @@ -1283,46 +1295,50 @@ struct MInputContext */ int candidate_index; + /* @{ */ /***en Start and the end positions of the preedit text where - corresponds to. */ - /***ja preedit ¥Æ¥­¥¹¥ÈÃæ¤Ç¡¢¤ËÂбþ¤¹¤ëºÇ½é¤ÈºÇ¸å¤Î°ÌÃÖ¡£ + \ corresponds to. */ + /***ja preedit ¥Æ¥­¥¹¥ÈÃæ¤Ç¡¢\¤ËÂбþ¤¹¤ëºÇ½é¤ÈºÇ¸å¤Î°ÌÃÖ¡£ */ int candidate_from, candidate_to; + /* @} */ /***en Flag telling whether the current candidate group must be - shown or not. The function ->driver.filter () sets the + shown or not. The function \->driver.filter () sets the value to 1 when an input method required to show candidates, and sets the value to 0 otherwise. */ /***ja ¸½ºß¤Î¸õÊ䥰¥ë¡¼¥×¤òɽ¼¨¤¹¤ë¤«¤É¤¦¤«¤ò¼¨¤¹¥Õ¥é¥°¡£ - ´Ø¿ô ->driver.filter () ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¤¬¸õÊä¤Îɽ¼¨¤òÍ׵ᤷ¤¿»þ¤³¤ÎÃͤò + ´Ø¿ô \->driver.filter () ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¤¬¸õÊä¤Îɽ¼¨¤òÍ׵ᤷ¤¿»þ¤³¤ÎÃͤò 1 ¤Ë¡¢¤½¤ì°Ê³°¤Î»þ 0 ¤ËÀßÄꤹ¤ë¡£ */ int candidate_show; - /***en The function ->driver.filter () sets the value to bitwise + /***en The function \->driver.filter () sets the value to bitwise OR of @c enum @c MInputCandidatesChanged when it changed any of - the above members (), and sets the value to 0 + the above members (\), and sets the value to 0 otherwise. */ - /***ja ´Ø¿ô ->driver.filter () ¤Ï¡¢¾åµ­¤Î¥á¥ó¥Ð + /***ja ´Ø¿ô \->driver.filter () ¤Ï¡¢¾åµ­¤Î¥á¥ó¥Ð \ ¤Î£±¤Ä¤Ç¤âÊѹ¹¤·¤¿ºÝ¤Ë¤Ï¡¢¤³¤ÎÃͤò @c enum @c MInputCandidatesChanged ¤Î¥Ó¥Ã¥Èñ°Ì¤Ç¤ÎÏÀÍý OR ¤ËÀßÄꤹ¤ë¡£¤½¤¦ ¤Ç¤Ê¤±¤ì¤Ð 0 ¤ËÀßÄꤹ¤ë¡£ */ int candidates_changed; - /***en Plist that can be freely used by ->driver functions. + /***en Plist that can be freely used by \->driver functions. The driver of internal input method uses it to exchange extra arguments and result for callback functions. The function - ->driver.create_ic () sets this to an empty plist, and the - function ->driver.destroy_ic () frees it by using + \->driver.create_ic () sets this to an empty plist, and the + function \->driver.destroy_ic () frees it by using m17n_object_unref (). */ - /***ja ->driver ¤Î´Ø¿ô·²¤Ë¤è¤Ã¤Æ¼«Í³¤Ë»ÈÍѤǤ­¤ë plist¡£ + /***ja \->driver ¤Î´Ø¿ô·²¤Ë¤è¤Ã¤Æ¼«Í³¤Ë»ÈÍѤǤ­¤ë plist¡£ ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥɥ饤¥Ð¤Ï¤³¤ì¤ò¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤È¤Î°ú¿ô¤äÊÖÃÍ - ¤Î¼õÅϤ·¤Ë»ÈÍѤ¹¤ë¡£´Ø¿ô ->driver.create_ic () ¤Ï¤³¤Î plist - ¤ò¶õ¤ËÀßÄꤹ¤ë¡£´Ø¿ô->driver.destroy_ic () ¤Ï + ¤Î¼õÅϤ·¤Ë»ÈÍѤ¹¤ë¡£´Ø¿ô \->driver.create_ic () ¤Ï¤³¤Î plist + ¤ò¶õ¤ËÀßÄꤹ¤ë¡£´Ø¿ô\->driver.destroy_ic () ¤Ï m17n_object_unref () ¤òÍѤ¤¤Æ¤³¤Î plist ¤ò²òÊü¤¹¤ë¡£ */ MPlist *plist; }; /*=*/ +/*** @} */ +/*=*/ extern MInputMethod *minput_open_im (MSymbol language, MSymbol name, void *arg); @@ -1372,12 +1388,9 @@ extern MPlist *minput_get_variables (MSymbol language, MSymbol name); extern int minput_set_variable (MSymbol language, MSymbol name, MSymbol variable, void *value); -/*=*/ -/*** @} */ extern MInputMethod *mdebug_dump_im (MInputMethod *im, int indent); - M17N_END_HEADER #endif /* _M17N_H_ */ diff --git a/src/mtext.c b/src/mtext.c index 1331ff6..22e529b 100644 --- a/src/mtext.c +++ b/src/mtext.c @@ -1728,7 +1728,7 @@ mtext () short ñ°Ì¤Ç¤¢¤ë¡£ $FORMAT ¤¬ #MTEXT_FORMAT_UTF_32LE ¤« #MTEXT_FORMAT_UTF_32BE ¤Ê¤é¤Ð¡¢ - $DATA ¤ÎÆâÍƤÏ@c unsigned ·¿¤Ç¤¢¤ê¡¢$NITEMS ¤Ï unsigned ñ°Ì¤Ç¤¢¤ë¡£ + $DATA ¤ÎÆâÍÆ¤Ï @c unsigned ·¿¤Ç¤¢¤ê¡¢$NITEMS ¤Ï unsigned ñ°Ì¤Ç¤¢¤ë¡£ ³ä¤êÅö¤Æ¤é¤ì¤¿ M-text ¤Îʸ»úÎó¤ÏÊѹ¹¤Ç¤­¤Ê¤¤¡£$DATA ¤ÎÆâÍÆ¤Ï M-text ¤¬Í­¸ú¤Ê´Ö¤ÏÊѹ¹¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ @@ -2456,9 +2456,9 @@ mtext_copy (MText *mt1, int pos, MText *mt2, int from, int to) /***ja @brief »ØÄêÈϰϤÎʸ»ú¤òÇ˲õŪ¤Ë¼è¤ê½ü¤¯. - ´Ø¿ô mtext_del () ¤Ï¡¢M-text $MT ¤Î $FROM ¡Ê$FROM ¼«ÂΤâ´Þ¤à¡Ë¤«¤é $TO - ¡Ê$TO ¼«ÂΤϴޤޤʤ¤¡Ë¤Þ¤Ç¤Îʸ»ú¤òÇ˲õŪ¤Ë¼è¤ê½ü¤¯¡£·ë²ÌŪ¤Ë $MT ¤ÏŤµ¤¬ ($TO @c - - $FROM) ¤À¤±½Ì¤à¤³¤È¤Ë¤Ê¤ë¡£ + ´Ø¿ô mtext_del () ¤Ï¡¢M-text $MT ¤Î $FROM ¡Ê$FROM ¼«ÂΤâ´Þ¤à¡Ë¤«¤é + $TO ¡Ê$TO ¼«ÂΤϴޤޤʤ¤¡Ë¤Þ¤Ç¤Îʸ»ú¤òÇ˲õŪ¤Ë¼è¤ê½ü¤¯¡£·ë²ÌŪ¤Ë + $MT ¤ÏŤµ¤¬ ($TO @c - $FROM) ¤À¤±½Ì¤à¤³¤È¤Ë¤Ê¤ë¡£ @return ½èÍý¤¬À®¸ù¤¹¤ì¤Ð mtext_del () ¤Ï 0 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 diff --git a/src/symbol.c b/src/symbol.c index e25d2dc..71f2dec 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -220,13 +220,14 @@ msymbol__list (MSymbol prop) o convert all uppercase characters to lowercase. o remove all non alpha-numeric characters. o change the leading "ibm" to "cp". - o change the leading "cp" to "ibm" + o change the leading "windows-" to "cp". + o change the leading "cp" to "ibm". o remove the leading "iso". For instance: "ISO-8859-2" -> "88592" "euc-JP" -> "eucjp" "IBM851" -> "cp851" - "CP1250" -> "ibm1250" + "windows-1250" -> "cp250" This function is used to canonicalize charset and coding system names. */ @@ -269,7 +270,15 @@ msymbol__canonicalize (MSymbol sym) canon[1] = 'b'; canon[2] = 'm'; } - + else if (canon[0] == 'w' && p - canon > 7 + && memcmp (canon + 1, "indows", 6) == 0 + && isdigit (canon[7])) + { + /* Change "windowsXXX" to "cpXXX" */ + canon += 5; + canon[0] = 'c'; + canon[1] = 'p'; + } return msymbol (canon); }