File: statemachine.html

package info (click to toggle)
fontforge 1%3A20230101~dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 63,260 kB
  • sloc: ansic: 462,618; python: 6,916; cpp: 214; objc: 122; sh: 101; makefile: 55; xml: 11
file content (324 lines) | stat: -rw-r--r-- 24,649 bytes parent folder | download | duplicates (3)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<HTML>
<HEAD>
  <!-- Created with AOLpress/2.0 -->
  <!-- AP: Created on: 27-Sep-2003 -->
  <!-- AP: Last modified: 21-Mar-2005 -->
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<!--<TITLE>The Mac State Machine dialog</TITLE>-->
    <TITLE>Mac の状態機械ダイアログ</TITLE>
  <LINK REL="icon" href="../../_static/fftype16.png">
  <LINK REL="stylesheet" TYPE="text/css" HREF="FontForge.css">
</HEAD>
<BODY>
<DIV id="in">
<H1 ALIGN=Center>
<!--The Mac State Machine Dialog-->
    Mac 状態機械ダイアログ
</H1>
<P>
<IMG src="../../_images/statemachine-context.png" WIDTH="490" HEIGHT="599" ALIGN="Right"><!--The
mac uses state machines where opentype would use a contextual lookup. The
example at right (with appropriate substitutions attached to it) will convert
an initial or medial short-s into a long-s (for doing renaissance printing). -->
OpenType では文脈依存の参照を用いているのに対し、Mac では状態機械を用いています。右に示す例 は (それに付随する適切な置換と組み合わさって) 単語の先頭または中間にある短い s を (ルネッサンス調の印刷を行うために) 長い s に置換します。
<P>
<!--
FontForge currently supports 4 types of state machines: contextual glyph
substitution, indic rearrangement, contextual glyph insertion, and contextual
kerning. The example at right is of contextual glyph substitution. -->
FontForge は現在 4 つのタイプの状態機械をサポートしています: 文脈依存のグリフ置換、インド系文字の再配置、文脈依存のグリフ挿入、そして文脈依存のカーニングです。右に示す例は文脈依存のグリフ置換です。
<P>
<!--
State machines have certain similar features. All but kerning be assigned
to a
<A HREF="http://developer.apple.com/fonts/Registry/index.html">feature/setting</A>
combination, they all have a set of flags indicating in what circumstances
they apply, they all have the glyphs of the font assigned to a set of classes,
and finally they all have a series of transitions indicating how each state
behaves when given input from the specified class.
状態機械にはいくつかの同様な機能があります。カーニング以外のすべてのタイプには<A HREF="http://developer.apple.com/fonts/Registry/index.html">機能/設定</A>の組合せが割り当てられています。また、どのタイプの機能にも、いかなる状況下でそれを適用すべきかを示すフラグのセットと、一連のクラスに割り当てられたフォントのグリフと、そして、各状態が各所定のクラスから入力が与えられた場合にどのように振舞うかを示す一連の状態遷移とが含まれています。
<P>
<!--
An example conditional substitution state machine is provided in the
<A HREF="editexample6-5.html#Apple">tutorial</A>. -->
条件つき置換を行う状態機械の例が<A HREF="editexample6-5.html#Apple">チュートリアル</A>にあります。
<P>
<!--
On the mac there are four predefined classes, one meaning the end of input,
one for all glyphs not specified elsewhere, one for the magic "deleted" glyph
(Apple does not always delete a glyph when asked to do so, instead it retains
a special mark in the glyph stream indicating that the glyph should be deleted
later), and finally a class for the end of a line of text. Any classes after
this are user defined. In the example at right there is one user defined
class and it contains the letters in the latin alphabet. Any other glyphs
in the font (the digits for example) will automatically be assigned to class
1 ("{Everything Else}"). -->
Mac では 4 個の定義済みクラスが存在します。1 個は入力の終わりを意味するもので、1 個は他のどこでも指定しないグリフに対応し、1 個は特別な“deleted”グリフ (Apple 式では、削除を指示したばあい、常に即座に削除するのではなく、そのグリフを後で削除することを指定する特殊な印をグリフストリーム内に保持することがあります) に該当し、最後のクラスはテキスト行の末尾に対応するものです。これら 4 つに続く任意のクラスはユーザが定義したものです。
<P>
<!--
The state machine itself is shown as a two dimensional matrix of transition,
one transition for every state and class. Classes are shown at the top of
the matrix, and states down the side. The transition from state 0 when given
input from class 0 is shown in the upper left corner of the matrix, and so
on. -->
状態機械そのものは、各状態とクラスの対に対して 1 個の状態遷移が対応するような、状態遷移の 2 次元行列として表示されます。クラスは行列の上に表示され、状態は横に縦書きで表示されます。クラス 0 に含まれる入力が与えられた時の状態 0 からの遷移が左上にあり、他の要素も同様です。
<P>
<!--
When the state machine starts up it will be in one of the first two states.
It will be in state 0 at the beginning of input, and in state1 when it starts
at the beginning of a new line. -->
状態機械の開始時には、最初の 2 個の状態のどちらかをとっています。入力の最初では状態 0 となり、新しい行が開始された時には状態1 となります。
<P>
<!--
The <A NAME="transitions">transitions</A> look slightly differently depending
on the type of state machine: -->
<A NAME="transitions">状態遷移</A>の表示は、状態機械のタイプによりわずかに違いがあります:
<TABLE BORDER CELLPADDING="2">
  <TR>
<!--<TH>Indic</TH>-->
    <TH>インド系</TH>
<!--<TH>Contextual</TH>-->
    <TH>文脈依存</TH>
<!--<TH>Insertion</TH>-->
    <TH>挿入</TH>
<!--<TH>Kerning</TH>-->
    <TH>カーニング</TH>
  </TR>
  <TR>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/transition-indic.png" WIDTH="54" HEIGHT="64"></TD>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/transition-context.png" WIDTH="54" HEIGHT="64"></TD>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/transition-insert.png" WIDTH="54" HEIGHT="64"></TD>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/transition-kern.png" WIDTH="54" HEIGHT="64"></TD>
  </TR>
</TABLE>
<P>
<!--
The first line of all transitions shows the next state. The next line contains
a set of flags where "M" =&gt; the current glyph should be marked (the meaning
of this becomes apparent later), "A" =&gt; processing should advance to the
next glyph. For indic tables there is a third flag shown, "L" =&gt; the current
glyph is the last glyph of the indic rearrangement, while for kerning tables
there is a "P" flag indicating that the current glyph should be pushed onto
the kerning stack. -->
どの状態遷移でも、最初の行は次に移る状態を表します。次の行はフラグの集まりで、意味は以下の通りです:“M”⇒現在の文字に印づけがされる (この意味は後で説明します)、“A”⇒処理は次のグリフに進む。インド系のテーブルでは 3 番目のフラグがあります:“L”⇒現在のグリフはインド系文字の再配置の最後のグリフである。カーニングテーブルでは、現在のグリフをカーニングスタックに積むことを表す“P”フラグが存在します。
<P>
<!--
The last two lines have varied meanings depending on the type of the state
machine. -->
最後の 2 行は状態機械の種類によってさまざまに異なる意味をもちます。
<UL>
  <LI>
<!--For Indic transitions the two lines should be appended to get the indic
    rearrangement verb (in the example above that would be "Ax =&gt; xA" meaning
    that the first glyph marked should be moved after the last glyph marked) -->
    インド系の状態遷移では、この 2 行はインド系再配置動詞を得るために追加されます (上の例は“Ax ⇒ xA”という表示で、印づけされた最初のグリフが印づけされた最後のグリフの後に移動するという意味です)。
  <LI>
<!--For contextual transitions the two lines specify the names (as 4 character
    tags) of nested substitutions. The first one is applied to the last glyph
    marked and the second one to the current glyph (if a line is blank, no
    substitution is applied to that glyph here).<BR> -->
    文脈依存の状態遷移ではこの 2 行は、入れ子になった置換の (4 文字のタグによる) 名前を指定します。最初の置換は印づけされた最後のグリフに適用され、2 番目は現在のグリフに適用されます (ある行が空である場合は、ここにあるグリフには置換は適用されません)<BR>
<!--If a transition has both a "marked substitution" and the "mark current glyph"
    flag, I believe the substitution applies to the glyph that was previously
    marked, and not to the current glyph. (Apple doesn't document
    this)<FONT COLOR="Red"><BR> -->
    ある状態遷移が“印つき置換”と“現在のグリフに印をつける”フラグの両方をもっていた場合、現在のグリフではなく、前回印づけされたグリフに置換が適用されるのだと私は解釈しています。(Apple の文書にはこれに関する記述がありません)<BR>
<FONT COLOR="Red">
<!--<STRONG>Caveat: </STRONG></FONT>Apple's 'mort' format was not designed to
    allow fonteditors to figure out what a state machine did. FontForge can usually
    make a good guess of what substitutions do which apply to the current glyph,
    but it will often include extraneous glyph substitutions when a substitution
    applies to a marked glyph. These should not be harmful (they should never
    get invoked) but they are annoying ('morx' tables should not have this problem). -->
    <STRONG>警告: </STRONG></FONT>Apple の&lsquo;mort&rsquo;フォーマットは、状態機械が何を行ったかをフォントエディタが表示できるように設計されていません。FontForge は多くの場合は現在のグリフにどの置換が適用されるかをうまく推測できますが、マークつきグリフに置換が適用される場合は余分なグリフ置換が含まれることがしばしばあります。これらは有害ではありません (それらが起動されることは決してありません) が、煩わしい余計物ではあります (&lsquo;morx&rsquo;テーブルにはこのような問題は無いはずです)。
  <LI>
<!--For insertion transitions the lines specify the glyphs that are to be inserted.
    The first line applies to the marked glyph, the second line to current glyph
    (there may not be room enough to show all the inserted glyphs, in which case
    the glyph list is truncated). There are additional flags here that are also
    not shown because of lack of room. They may be viewed by clicking on a
    transition. -->
    挿入タイプの状態遷移においては、各行は挿入されるグリフを指定します。最初の行はマークつきグリフに適用され、2 行目は現在のグリフに適用されます (挿入される文字をすべて表示する場所が無い場合は、表示は途中で切り詰められます)。場所の不足似より表示できない追加フラグもここには含まれています。それらは、状態遷移のマスをクリックすると表示されます。
  <LI>
<!--For kerning transitions the first line shows the first (few) kerning values,
    the second line shows either "..." if there are more kerning values, or
    nothing.<BR> -->
    カーニングの状態遷移においては、最初の行が最初の (2, 3 の) カーニング値を表し、2 行目は、表示しきれないカーニング値があることを示す“...”か、何も表示しないかのどちらかです。<BR>
<!--Note: The number of kerning values
    <FONT COLOR="Red"><STRONG>MUST</STRONG></FONT> match the number of glyphs
    pushed on the kern stack, or your application crashes. -->
    注意: カーニング値の個数はカーニングスタックに置かれたグリフの個数と一致<FONT COLOR="Red"><STRONG>しなければなりません</STRONG></FONT>。さもないとアプリケーションがクラッシュします。
</UL>
<P>
<!--
For a complete description of what these state machines can do you should
read Apple's documentation -->
これらの状態機械が何を行うかに関するより完全な説明については、Apple の文書を読む必要があります。
<UL>
  <LI>
<!--On the-->
<!--<A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6morx.html">'morx'</A>
    and
    <A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6mort.html">'mort'</A>
    tables -->
   &lsquo;<A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6morx.html">morx</A>&rsquo;および&lsquo;<A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6mort.html">mort</A>&rsquo;テーブルについて
  <LI>
<!--On the
    <A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6kern.html">'kern'</A>
    table (format 1) -->
    &lsquo;<A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6kern.html">kern</A>&rsquo;テーブル (フォーマット 1) について
  <LI>
<!--<A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6Tables.html#StateTables">On
    state machines in general</A> -->
    <A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6Tables.html#StateTables">状態遷移機械に関する一般論</A>
  <LI>
<!--<A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6feat.html">The
    'feat' (feature) table</A> -->
    <A HREF="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6feat.html">&lsquo;feat&rsquo;(機能) テーブル</A>
  <LI>
<!--<A HREF="http://developer.apple.com/fonts/Registry/index.html">Apple's Font
    Feature registry</A>-->
    <A HREF="http://developer.apple.com/fonts/Registry/index.html">Apple のフォント機能登録簿</A>
</UL>
<P>
<!--
The general idea is that a word processor converts text into a string of
glyphs, and then the state machine is applied to that string. The state machine
starts in state 0 or 1, it figures out what class the first glyph belongs
to, and indexes into the current state by that class. The transition at that
location provides a new state to move to (which might be the same as the
current one), it will usually advance to the next glyph (so the new state
will be indexed by a different glyph) but sometimes you will want to continue
processing the current glyph in the new state. Also it will perform a set
of operations which differ depending on the type of state machine. -->
一般的な考えは、ワードプロセッサがテキストをグリフの列に変換し、それから状態機械がそのグリフ列に適用されるというものです。状態機械は状態 0 または 1 から始まり、最初のグリフがどのクラスに属するかを調べ、現在の状態に置けるそのクラスのインデックスを調べます。その位置における状態遷移は移動すべき新しい状態 (現在の物と同じ場合もあります) を明らかにし、通常は次のグリフに移行します (それにより、新しい状態では異なるグリフのインデックスづけが行われます) が、場合によっては新しい状態で引き続き現在のグリフの処理が行われることもあります。また、状態機械のタイプによって異なる一連の操作も同時に実行されます。
<P>
<!--
Many of the state machines have the concept of a "marked" glyph. This is
important if the desired change for a given glyph depends on what glyphs
follow it. In that case when we reach an interesting glyph we "mark" it,
and then, after reading a few more glyphs when we know what to do, we apply
a transformation to the marked glyph. -->
状態機械の多くは“印づけされた”グリフの概念をもっています。これは、与えられたグリフに対する望ましい変更が、その後ろに来るグリフによって異なる場合に重要な意味をもちます。そのような場合、興味深いグリフにたどり着いたときにそれに“印づけ”を行い、その後、2, 3 の追加のグリフを読んで、何を行うべきかが判明した後に、マークづけしたグリフに変換を適用します。
<TABLE BORDER CELLPADDING="2">
  <TR>
<!--<TH>Indic</TH>-->
    <TH>インド系</TH>
<!--<TH>Contextual</TH>-->
    <TH>文脈依存</TH>
<!--<TH>Insertion</TH>-->
    <TH>挿入</TH>
<!--<TH>Kerning</TH>-->
    <TH>カーニング</TH>
  </TR>
  <TR VALIGN="Top">
    <TD><P ALIGN=Left>
<!--  In addition to a "mark"ed glyph, indic transformations also have a the concept
      of a "last" glyph. There are 16 transformations which may be applied the
      the glyphs between the "mark"ed and "last" glyphs. Suppose the glyph stream
      looks like<BR>
      &nbsp; &nbsp; abcdef<BR>
      And "a" was "mark"ed and "d" was "last" then a transition "AxD =&gt; DxA"
      refers to the marked glyph as "A", the last glyph as "D" and everything in
      between as "x", so this would change the glyph stream to<BR>
      &nbsp; &nbsp; dbcaef</TD> -->
      “印づけ”されたグリフの他に、インド系の変換においては“最後”のグリフという概念があります。“印づけ”されたグリフと“最後”のグリフの間に適用可能な変換が 16 種類あります。<BR>
      &nbsp; &nbsp; abcdef<BR>
      のようなグリフストリームを考えてみましょう。ここで“a”が“印づけ”された文字で、“d”が“最後”の文字であるとすると、状態遷移“AxD ⇒ DxA”は印づけられたグリフを“A”、最後のグリフを“D”、そしてその間のすべての文字を“x”として参照するので、これによりグリフストリームは<BR>
      &nbsp; &nbsp; dbcaef<BR>
      に変更されます。</TD>
<!--<TD>This can apply a substitution to the current glyph, a different substitution
      to the marked glyph, and it may mark the current glyph. The substitutions
      are indicated by 4 character tags and should be "Nested" substitutions which
      may be created by the Element-&gt;Char Info dialog.</TD> -->
    <TD>この機能は現在のグリフへの置換と、印づけされたグリフに対する別の置換をを適用することができ、また、現在のグリフに印づけを行うことができます。置換は 4 文字のタグによって表され、<CODE>エレメント(<U>L</U>)→グリフ情報(<U>I</U>)...</CODE> ダイアログで作成することが可能な“入れ子の”置換でなければなりません。
<!--<TD>This can insert a string (up to 31 glyphs) before or after the current
      and the marked glyphs.</TD> -->
    <TD>この機能は (31 個までののグリフからなる) 文字列を現在のグリフおよびマークづけされたグリフの前後に挿入することができます。</TD>
<!--<TD>Kerning does not have a single "mark"ed glyph, instead it can push up
      to 8 glyphs onto a stack, and at a later point a set of kerning values may
      be applied to those glyphs (so the flag which is usually indicated as "M"
      for mark, is here "P" for push). Once all the glyphs have been pushed, a
      set of kerning values may be applied. One value for each pushed glyph. This
      is a number which indicates how much the glyph in question should be kerned.
      If the glyph stream looks like:<BR>
      &nbsp; &nbsp; F."<BR>
      and you want to kern "." by -300, and """ by 0 em-units, then you would
      enter<BR>
      &nbsp; &nbsp; -300 0<BR>
      as kerning values.</TD> -->
    <TD>カーニングでは 1 個の“印づけ”されたグリフは存在せず、その代わりにスタックに 8 個までのグリフを積んでおいて、それらのグリフに適用される一連のカーニング値を後で指定する個とができます (そのため、他の機能で印を表すフラグは“Mark”の頭文字“M”であるのに対し、この機能では“Push”の頭文字“P”となっています)。いちどすべてのグリフを積んだ後で、一連のカーニング値を適用することができます。スタックに積んだ各グリフごとに値 1 個が対応します。これは、いくつのグリフがカーニングを施されるかを示す数値です。
      例えば、グリフストリームが<BR>
      &nbsp; &nbsp; F."<BR>
      であったとして、“.”を -300,“"”を 0 em ユニットだけカーニングしたい場合、カーニング値を<BR>
      &nbsp; &nbsp; -300 0<BR>
      と指定することになります。
  </TR>
</TABLE>
<H2>
<!--Editing <A NAME="EditTransition">Transitions</A>-->
    <A NAME="EditTransition">状態遷移</A>の編集方法
</H2>
<P>
<!--
To edit a transition, simply click on it and a dialog will pop up, appropriate
to the type of state machine. -->
状態遷移を編集するには、その上で単にクリックすると、その状態機械のタイプに合わせたダイアログが起動します。
<TABLE BORDER CELLPADDING="2">
  <TR>
<!--<TH>Indic</TH>-->
    <TH>インド系</TH>
<!--<TH>Contextual</TH>-->
    <TH>文脈依存</TH>
<!--<TH>Insertion</TH>-->
    <TH>挿入</TH>
<!--<TH>Kerning</TH>-->
    <TH>カーニング</TH>
  </TR>
  <TR>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/edittransition-indic.png" WIDTH="282" HEIGHT="431"></TD>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/edittransition-context.png" WIDTH="282" HEIGHT="431"></TD>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/edittransition-insert.png" WIDTH="282" HEIGHT="431"></TD>
    <TD><P ALIGN=Center>
      <IMG src="../../_images/edittransition-kern.png" WIDTH="282" HEIGHT="431"></TD>
  </TR>
</TABLE>
<P>
<!--
See <A HREF="statemachine.html#transitions">above</A> for a description of
what the fields mean. -->
各フィールドの意味の説明は、<A HREF="statemachine.html#transitions">前述</A>の記載を参照してください。
<P>
<!--
If you wish to add a new state, simply edit a transition so that its next
state field is the state number desired. FontForge will automatically create
the state for you. -->
新しい状態を追加したい場合、次状態のフィールドに必要な状態番号を入力してください。FontForge は必要な状態欄を自動的に追加します。
<H2>
<!--<A NAME="EditClass">Classes</A>-->
    <A NAME="EditClass">クラス</A>
</H2>
<P>
<!--
<IMG SRC="statemachine-class.png" WIDTH="490" HEIGHT="587" ALT="Adding a class to the state machine dialog"
    ALIGN="Right">If you wish to add a new class press the [New] button under
the list of classes. If you wish to edit a class double click on that class.
The dialog should change to be like the one at right. The text field contains
a list of the names of the glyphs in this class. Pressing the [Set] button
will set that field to any selected glyphs in the font view. Pressing the
[Select] button will change the selection in the font view to match the glyphs
in the text.<BR Clear=ALL> -->
<IMG src="../../_images/statemachine-class.png" WIDTH="490" HEIGHT="587" ALT="「状態マシンへのクラス追加」ダイアログ" ALIGN="RIGHT">
新しいクラスを追加したいときは、ダイアログの下の <CODE>[新規(<U>N</U>)]</CODE> ボタンを押してください。クラスを編集したい場合は、そのクラスをダブルクリックしてください。ダイアログの表示が右に示したように変更されるはずです。テキストフィールドには、個のクラスに属するグリフ名のリストが含まれています。<CODE>[セット]</CODE> ボタンを押すとフォントビュー内で選択中のすべての文字からなるリストに変更されます。<CODE>[選択]</CODE> ボタンを押すとフォントビュー内の選択文字がテキストフィールド内のグリフと一致するように変更されます。<BR Clear=ALL> 
<P>
<P ALIGN=Center>
— <A HREF="fontinfo.html">上</A> — <A HREF="overview.html">目次</A> —
</DIV>
</BODY></HTML>