先日発注したNASが届いたのですが、最近のNASって、Webサーバインストールされているのは知ってましたが、PHPとMySQLまで使えるとは知りませんでした。
そこで、Wordpress走らせてみたり、日頃運用しているWebアプリ動かしてみたりしているのですが...もう大きいサーバは要らないのでしょうかね?実際低価格帯のNASでもミラーリングが使えるしね。これでPostfixとか動けば良いんだけどって、黒箱買えって言われそうだね。
ちなみにここ数年MySQLは使ってません。めんどうですw
ここまでで250文字程度...やはりわたしにはtwitterは無理そうですw
またもや前置きが長くなっていますが、今回は旧ファイルフォーマットの文字の取扱い部分の解説です。面倒なのでテキストオブジェクトの解説だけさせて頂こうと思うんだね。もちろんこれから解説するオブジェクトはLayer以下の子要素なので「古いIllustratorファイルフォーマットについて 1」のファイルフォーマットのLb〜LBの間に配置すれば良いんだ。
資料の15章がテキストについての解説なんだけど、まずは引用から
15 Text
There are three kinds of text in Adobe Illustrator:
Point text is neither bounded by a path nor on a path. It is created by clicking the type tool to create an insertion point, then typing.
The first line of the text block begins at the insertion point. A carriage return determines the line breaks in point text.
Area text is bounded by a path. It is created by clicking the type tool and dragging a rectangle, and then starting to type.
You can also create area text by clicking a path, selecting the area type tool, and then typing. A single text object can contain multiple text area elements.
Text on a path follows the shape of a path. It is created by clicking a the path-type tool on a path, then typing.
Text can overflow an area frame and thus not be visible on screen or when printed. Adobe Illustrator still saves such overflow text to the file, however. Linked areas allow text to flow from one area to another. Linked areas are part of the same text object.
Note You cannot link point text or path text to an area text object. All flowed text must appear in area texts.
Text can be invisible if you set its style to neither fill nor stroke.
Such text is not rendered on the page, but Adobe Illustrator writes the text to the file with the same structure as if the text were rendered.
ご存知の通り、Illustratorでは3種類のテキストオブジェクトが利用されている訳だね。それに付いての解説なんだ。
ポイントテキスト、パステキスト、エリアテキストでそれぞれの特性に付いて記述しているのだけど、皆さん熟知していると思われるので省略。
15.1 Revisable and Final-Form Text
Adobe Illustrator writes out two kinds of information about text: revisable information and final-form printing information. Revisable
information consists of those settings the user makes and can examine in the various dialog boxes of Adobe Illustrator -- font size, for example.
Final-form information is regenerated by Adobe Illustrator once the file has been read -- it primarily helps to print text properly. Final-form information consists of character positioning, text flow from line to line and area to area, and similar information. This section differentiates between revisable, required information and final-form information.
Note You can safely leave final-form information out of files and still have Adobe Illustrator read them correctly and regenerate the information; however, the file will not be an official EPS file and will not print. Adobe Illustrator recalculates the values of all final-form operators after reading the file.
「Revisable」と「Final-Form」について Illustratorでは2種類のテキスト関連のオペレータが存在するんだけど、私たちが利用するのは「Revisable」の方なんだ。これは編集のときにチェックボックスをチェックしたり数値を入力したりするもので、フォントサイズや詰め設定なんかが相当するんだ。一方「Final-Form」というのはIllustratorが自動的に計算して生成するデータ。例えばキャラクタの配置や改行のコントロールなんかが相当する。こちらはデータ上から削除してしまっても問題にはならず、ファイルが読み込まれる時に再度自動的に生成されるらしいんだ。
テキストオブジェクトの構造はというと以下のようになるんだ。
<text at a point> |
<text area> |
<text along a path>
<TO>
上記の構造が一般的なテキストオブジェクトの構造。「To」オペレータから「TO」オペレータまでが一括りになってテキストオブジェクトを定義しているんだ。だからファイルが壊れてしまった場合はひっかかっているTo〜TOの構造が崩れた部分を破棄してしまうと残りの部分は開けたりするんだね。
Toオペレータの引数は前出のポイントテキスト、パステキスト、エリアテキストの選択を行うパラメータになっているんだ。
0 -- point text
1 -- area text
2 -- path text
さて、次にObjectの中身はというと、
<text at a point> ::= <Tp>
<TP>
<text run>+
<text area element> ::=<Tp>
<path object>
<TP>
<text run>+
<text along a path> ::= <Tp>
<path object>
<TP>
<text run>+
{<overflow text>}*
の3パターン 「Tp」オペレータで始まるのだけど、これのパラメータは
a b c d tx ty startPt Tp
と言う具合になっている。a〜dは「current transformation matrix」と呼ばれるモノで簡単に言うと縦横の偏倍と縦横の斜方向の変形のマトリクスになっている。通常は「1 0 0 1」で。ここで変形をコントロールするとややこしくなるので。
tx、tyはポイントテキストなら開始点。エリアテキストならエリアの左上の座標に重なる。パステキストでは関係ないパラメータとなるんだ。
startPtはパステキストだけに有効なパラメータで最初のアンカーからの位置を示す。1.5となると、2番目と3番目のアンカーの中点を示すんだ。
<paint style> |
<text position> |
<Tk>}*
<text body>
TPに続く
Tr (テキストレンダリングモード)
0 -- filled text
1 -- stroked text
2 -- filled and stroked text
3 -- invisible text
4 -- masked and filled text
5 -- masked and stroked text
6 -- masked, filled, and stroked text
7 -- masked (only) text
8 -- filled text followed by render mode 9 (pattern prototype only)
9 -- stroked text (preceded by render mode 8 text, pattern prototype only)
モード4〜7はパターン定義に関連するモード。8・9はパターンプロトタイプで利用されるモード。通常は普通の塗りや線を扱う0〜3を使うことになるね。
Tf(フォントとサイズ)
/_fontname size ascent descent Tf
まあ、見たまんま。後のサンプルを見ていただく方がしっくり来るでしょう。
Ts(ペースラインシフト)
パラメータはfloatingPoint、単位はpt。
Tz(スケーリング)
パラメータは垂直方向と水平方向の偏倍率。
Tt(トラッキング)
ユーザトラッキング。数値はem単位。
TA(カーニング(自動))
0でoff、1でon。
TC(文字間の空白)
minSpace optSpace maxSpace TC
最小値と指定値、最大値で指定するんだ。
TW(単語間の空白)
minSpace optSpace maxSpace TW
TCと同様。このあたりはパレット見ればどういうことか良くわかるね。
Ta(文字揃え)
0--left aligned
1--center aligned
2--right aligned
3--justified (right and left)
4--justified including last line
Tq(ぶらさがり)
これもboolean。0でoff、1でon。
Ti(インデント)
Tl(一行目のインデント)
TV(文字の方向)
縦組中の半角文字の回転を行うかどうか。
Xu (Japanese layout rules)
日本語ルールを適用するかどうか。
ここまででおおよそのオペレータ類は列挙できているので、あとは省略という事にします。
さて、肝心のテキストオブジェクトの並べ方ですが下の例をどうぞ。
0 To
1 0 0 1 217.7148 451.3359 0 Tp
0 Tv
TP
0 Tr
/_FutoGoB101-Bold-83pv-RKSJ-H 7.09 6.2392 -0.8508 Tf
100 100 Tz
(文字列¥r) TX
TO
基本的にはTXオペレータのパラメータとして与えればOKなんだけど、これをやると日本語の一部でエラーを生じさせるんだね。これは「¥」問題の一部で、shiftJISの一部のコードが0x5cのコードを内包するために生じるエラーなんだね。このエラーを生じさせるキャラクターは
十(0x8f5c)
ソ(0x835c)
が代表的なものだけど、他にも下位バイト0x5cを含むものはエラーになります。最良の対処法はIllustratorと同様にCJKの文字コードは8進数でエスケープしてしまう事。例えばVBだと下のようなコードを通すと
octCd = "¥" & Oct(AscB(MidB(wds, i, 1))) & "¥" & Oct(AscB(MidB(wds, i + 1, 1)))
Illustratorが生成するものと同様のエスケープが可能なんだ。
面倒な人はエラーが出るキャラクターの後に「¥」を入れてあげてください。エスケープしておくと正しく認識してくれます。
という訳で下のような感じでどうぞ。もちろん「¥」は半角ですよ。
0 To
1 0 0 1 217.7148 451.3359 0 Tp
0 Tv
TP
0 Tr
/_FutoGoB101-Bold-83pv-RKSJ-H 7.09 6.2392 -0.8508 Tf
100 100 Tz
(五十¥五¥r) TX
TO
全くIllustratorとは関係ないのですが、XMLとJSONのデータ形式のスループットを検証してみました。やはりJSONの方が高速に処理できるみたいですね。という事なのでDBからの出力は基本JSONで行こうと思う今日この頃です。
コメントする