blob: e079a7aa1ec438cc6e7c614a530ac65635640c5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
% xetexko-hanging.sty
%
% Copyright (c) 2013-2014 Dohyun Kim <nomos at ktug org>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax\else
\ProvidesPackage{xetexko-hanging}
[2014/05/11 v2.6 Hanging punctuations for XeTeX-ko]
\fi
\chardef\catcodeofATcharacter\catcode`@
\catcode`\@ = 11
\let\XK@orig@periodboxstop \XKperiodboxstop
\let\XK@orig@commaboxstop \XKcommaboxstop
\let\XK@orig@closingquotestop \XKclosingquotestop
\let\XK@orig@openingquotestart\XKopeningquotestart
\let\XK@orig@postcjkfullstop \postcjkfullstop
\let\XK@orig@postcjkcloseparen\postcjkcloseparen
\let\XK@orig@precjkopenparen@ \precjkopenparen@
\def\disablehangingpunctuation{%
\let\XKperiodboxstop \XK@orig@periodboxstop
\let\XKcommaboxstop \XK@orig@commaboxstop
\let\XKclosingquotestop \XK@orig@closingquotestop
\let\XKopeningquotestart\XK@orig@openingquotestart
\let\postcjkfullstop \XK@orig@postcjkfullstop
\let\postcjkcloseparen \XK@orig@postcjkcloseparen
\let\precjkopenparen@ \XK@orig@precjkopenparen@
}
\let\disablehangingpunctuations\disablehangingpunctuation
\ifdefined\strip@pt\else
\begingroup
\catcode`P=12
\catcode`T=12
\lowercase{\def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}
\expandafter\endgroup\x
\def\strip@pt{\expandafter\rem@pt\the}
\fi
\ifcsname AtBeginDocument\endcsname\else \def\AtBeginDocument#1{#1} \fi
\AtBeginDocument{
\begingroup
\setbox\z@\hbox{가.}\setbox\tw@\hbox{가}%
\xdef\temp@a
{\strip@pt\dimexpr(\wd\z@-\wd\tw@)*65536/\number\dimexpr 1em\relax\relax}%
\setbox\z@\hbox{가'}%
\xdef\temp@b
{\strip@pt\dimexpr(\wd\z@-\wd\tw@)*65536/\number\dimexpr 1em\relax\relax}%
\endgroup
\edef\xetexko@periodwidth{\temp@a em}%
\edef\xetexko@quotewidth {\temp@b em}%
\def\XKperiodboxstop{%
\XK@orig@periodboxstop
%\ifnum\XKcurrentfont>\z@
\count@\spacefactor
\XKH@post@hang\xetexko@periodwidth
\spacefactor\count@
%\fi
}%
\def\XKcommaboxstop{%
\XK@orig@commaboxstop
%\ifnum\XKcurrentfont>\z@
\count@\spacefactor
\XKH@post@hang\xetexko@periodwidth
\spacefactor\count@
%\fi
}%
\def\XKclosingquotestop{%
\XK@orig@closingquotestop \XKH@post@hang\xetexko@quotewidth
}%
\def\XKopeningquotestart{%
\XKH@pre@hang\xetexko@quotewidth \XK@orig@openingquotestart
}%
\def\precjkopenparen@{%
\@josa@char@to@number\@let@token\count@
\dimen@\XeTeXglyphbounds\@ne\XeTeXcharglyph\count@
\dimen@\dimexpr\fontcharwd\font\count@-\dimen@\relax
\ifdim\dimen@<.5em \dimen@.5em \else\advance\dimen@.1em \fi
\ifx^^^^201c\@let@token
\dimen@ii\dimen@ \advance\dimen@ii-.125em
\XKH@pre@hang\dimen@ii
\else\ifx^^^^2018\@let@token \XKH@pre@hang\dimen@
\fi\fi
\leavevmode\hbox to\dimen@\bgroup\hss
\XeTeXinterchartoks\XKboundary\XKcjkopening = {\empty}%
}%
\def\postcjkcloseparen{%
\XK@orig@postcjkcloseparen
\ifx^^^^3001\@let@token \XKH@post@hang\dimen@
\else\ifx^^^^ff0c\@let@token \XKH@post@hang\dimen@
\else\ifx^^^^201d\@let@token
\dimen@ii\dimen@ \advance\dimen@ii-.125em
\XKH@post@hang\dimen@ii
\else\ifx^^^^2019\@let@token \XKH@post@hang\dimen@
\fi\fi\fi\fi
}%
\def\postcjkfullstop{%
\XK@orig@postcjkfullstop \XKH@post@hang\dimen@
}%
}
\def\XKH@post@hang#1{%
\nobreak\hskip\z@\relax
\vrule width-#1 height\z@ depth\z@
\kern#1\relax
}
\def\XKH@pre@hang#1{%
\kern#1\relax
\vrule width-#1 height\z@ depth\z@
\nobreak\hskip\z@\relax
}
\let\hangingpunctuation\relax
\let\hangingpunctuations\relax
\catcode`\@\catcodeofATcharacter
\endinput
|