bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XeTeX encoding problem


From: Masamichi HOSODA
Subject: Re: XeTeX encoding problem
Date: Sun, 07 Feb 2016 23:20:35 +0900 (JST)

> I have a different suggestion for fixing this issue: execute
> \unicodechardefs only once in each run, and make the expansion of each
> character use a condition. The value of the condition can be changed
> to control what the characters do without redefining all of the
> characters.
> 
> The same could be done for \nonasciistringdefs. I was thinking of
> making this change before when I was looking at an log of macro
> expansion and was scrolling past many lines that resulted from the
> redefinitions of non-ASCII characters.

Thank you for your suggestion.
I've made the native Unicode replace switching patch.

ChangeLog:

Native Unicode replace switching instead of re-definition

2016-02-XX  Masamichi Hosoda  <address@hidden>

        * doc/texinfo.tex:
        Native Unicode replace switching instead of re-definition.
        
        (\ifnativeunicodereplace): New switch.
        (\DeclareUnicodeCharacterNative):
        Integrate \DeclareUnicodeCharacterNativeThru.
        Add capable to switch replace or pass-through characters.
        (\DeclareUnicodeCharacterNativeThru): Remove.
        (\nativeunicodechardefsthru): Remove.
        (\passthroughcharacters):
        Use switch instead of \nativeunicodechardefsthru
--- texinfo.tex.org     2016-02-07 21:50:24.667799700 +0900
+++ texinfo.tex 2016-02-07 22:56:21.374334100 +0900
@@ -10798,12 +10798,25 @@
 % For native Unicode (XeTeX and LuaTeX)
 % Definition macro to replace the Unicode character
 %
+\newif\ifnativeunicodereplace
+\nativeunicodereplacetrue
+
 \def\DeclareUnicodeCharacterNative#1#2{%
   \catcode"#1=\active
-  \begingroup
-    \uccode`\~="#1\relax
-    \uppercase{\gdef~}{#2}%
-  \endgroup}
+  \ifnativeunicodereplace
+    \begingroup
+      \uccode`\~="#1\relax
+      \uppercase{\gdef~}{#2}%
+    \endgroup
+  \else
+    \begingroup
+      \uccode`\.="#1\relax
+      \uppercase{\endgroup \def\UTFNativeTmp{.}}%
+    \begingroup
+      \uccode`\~="#1\relax
+      \uppercase{\endgroup \edef~}{\UTFNativeTmp}%
+  \fi
+}
 
 % Native Unicode (XeTeX and LuaTeX) character replacing definitions
 % It makes the setting that replace the Unicode characters.
@@ -10812,27 +10825,6 @@
   \unicodechardefs
 }
 
-% For native Unicode (XeTeX and LuaTeX)
-% Definition macro not to make the Unicode character expand to a non-active 
-% token with the same character code.  Used when writing to auxiliary files.
-%
-\def\DeclareUnicodeCharacterNativeThru#1#2{%
-  \catcode"#1=\active
-  \begingroup
-    \uccode`\.="#1\relax
-    \uppercase{\endgroup \def\UTFNativeTmp{.}}%
-  \begingroup
-    \uccode`\~="#1\relax
-    \uppercase{\endgroup \edef~}{\UTFNativeTmp}%
-}
-
-% Native Unicode (XeTeX and LuaTeX) character ``through'' definitions.
-% It makes the setting that does not replace the Unicode characters.
-\def\nativeunicodechardefsthru{%
-  \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeThru
-  \unicodechardefs
-}
-
 % For native Unicode (XeTeX and LuaTeX).  Make the character token expand
 % to the sequences given in \unicodechardefs for printing.
 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
@@ -10920,7 +10912,7 @@
   \iftxiusebytewiseio
     \nonasciistringdefs
   \else
-    \nativeunicodechardefsthru
+    \nativeunicodereplacefalse
   \fi
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]