このページで紹介した、WPFの縦書きをライブラリ化しました。
http://blogs.wankuma.com/mnow/archive/2010/10/30/194350.aspx
こんな風に呼べます。
Uniscribe uniscribe = new Uniscribe();
string inChars = "私の名前はえムナウです。";
SCRIPT_ITEM[] items;
OPENTYPE_TAG[] scriptTags;
int itemsCount = uniscribe.ScriptItemize(inChars, out items, out scriptTags);
System.Diagnostics.Debug.Print("inChars={0}", inChars);
for (int index = 0; index < itemsCount; index++)
{
OPENTYPE_TAG tagScript = scriptTags[index];
System.Diagnostics.Debug.Print("iCharPos={0}, flags={1} tagScript={2:x}", items[index].iCharPos, items[index].a.flags, tagScript);
}
WindowInteropHelper helper = new WindowInteropHelper(App.Current.MainWindow);
for (int index = 0; index < itemsCount; index++)
{
ushort[] logClust;
SCRIPT_CHARPROP[] charProps;
ushort[] glyphs;
SCRIPT_GLYPHPROP[] glyphProps;
int length = inChars.Length - items[index].iCharPos;
if (index + 1 < itemsCount)
{
length = items[index + 1].iCharPos - items[index].iCharPos;
}
int glyphCount = uniscribe.ScriptShape(inChars, items[index].iCharPos, length,
items, scriptTags, itemsCount, helper.Handle, "msgothic", 200,
out logClust, out charProps, out glyphs, out glyphProps);
System.Diagnostics.Debug.Print("Gryphs={0}", glyphCount);
for (int gryphIndex = 0; gryphIndex < glyphCount; gryphIndex++)
{
System.Diagnostics.Debug.Print(
"Gryph logClust={0}, charProps={1}, glyphs={2}, glyphProps={3}",
logClust[gryphIndex], charProps[gryphIndex].flags, glyphs[gryphIndex], glyphProps[gryphIndex].sva);
}
}
ここの縦書きライブラリに置いておきますのでよかったらどうぞ。
http://www.mnow.jp/tabid/220/Default.aspx