From: ishmal Date: Mon, 30 Jun 2008 20:04:11 +0000 (+0000) Subject: fix range problem X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=602c178a44bca0ce3843470edd0a349a3fb9c09c;p=inkscape.git fix range problem --- diff --git a/src/dom/ucd.cpp b/src/dom/ucd.cpp index 602c71630..3747334d2 100644 --- a/src/dom/ucd.cpp +++ b/src/dom/ucd.cpp @@ -1,5 +1,5 @@ /* - * Generated by UcdReader at:Tue Jun 24 11:58:24 GMT-06:00 2008 + * Generated by UcdReader at:Mon Jun 30 13:52:41 GMT-06:00 2008 * block table size:2 (4 bytes) * plane table size:6 (64 bytes) * @@ -2265,11 +2265,17 @@ static unsigned int prop[] = #define UNI_CODE(ch) (prop[block[plane[(ch>>8)&8191]+((ch>>2)&63)]+(ch&3)]) +/** + * Get type part of code + + */ +#define UNI_CODE_TO_TYPE(ch) (ch & 0x1f) + /** * Fetch the category type */ -#define UNI_TYPE(ch) (UNI_CODE(ch) & 0x1f) +#define UNI_TYPE(ch) (UNI_CODE_TO_TYPE(UNI_CODE(ch))) /** * Fetch the digit offset @@ -2461,28 +2467,28 @@ int uni_is_defined(int ch) int uni_is_letter(int ch) { - int c = UNI_CODE(ch); + int c = UNI_TYPE(ch); return (c>=UNI_UPPERCASE_LETTER && c<=UNI_OTHER_LETTER); } int uni_is_letter_or_digit(int ch) { - int c = UNI_CODE(ch); + int c = UNI_TYPE(ch); return ((c>=UNI_UPPERCASE_LETTER && c<=UNI_OTHER_LETTER) || c==UNI_DECIMAL_DIGIT_NUMBER); } int uni_is_space(int ch) { - int c = UNI_CODE(ch); + int c = UNI_TYPE(ch); return (c==UNI_SPACE_SEPARATOR || c==UNI_LINE_SEPARATOR - || c==UNI_PARAGRAPH_SEPARATOR); + || c==UNI_PARAGRAPH_SEPARATOR || (ch>= 0x09 && ch <= 0x0d)); } int uni_to_lower(int ch) { int c = UNI_CODE(ch); - if (c == UNI_LOWERCASE_LETTER) + if (UNI_CODE_TO_TYPE(c) == UNI_LOWERCASE_LETTER) return ch; ch -= (c>>18) & 0x1ff; return ch; @@ -2491,7 +2497,7 @@ int uni_to_lower(int ch) int uni_to_upper(int ch) { int c = UNI_CODE(ch); - if (c == UNI_UPPERCASE_LETTER) + if (UNI_CODE_TO_TYPE(c) == UNI_UPPERCASE_LETTER) return ch; ch += (c>>18) & 0x1ff; return ch; @@ -2500,7 +2506,7 @@ int uni_to_upper(int ch) int uni_to_title(int ch) { int c = UNI_CODE(ch); - if (c == UNI_TITLECASE_LETTER) + if (UNI_CODE_TO_TYPE(c) == UNI_TITLECASE_LETTER) return ch; ch += (c>>18) & 0x1ff; return ch; diff --git a/src/dom/ucd.h b/src/dom/ucd.h index d8b301d47..c4d0ab4e0 100644 --- a/src/dom/ucd.h +++ b/src/dom/ucd.h @@ -1,17 +1,25 @@ /** + * Phoebe DOM Implementation. * - * Inkscape Unicode Character Database (UCD) 5.1.0. Utility + * This is a C++ approximation of the W3C DOM model, which follows + * fairly closely the specifications in the various .idl files, copies of + * which are provided for reference. Most important is this one: * + * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html + * + * More thorough explanations of the various classes and their algorithms + * can be found there. + * * * Authors: * Bob Jamison * - * Copyright (C) 2008 Bob Jamison + * Copyright (C) 2006-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,7 +29,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * + * */ #ifndef __UCD_H__ #define __UCD_H__