血統の森+はてな

旧はてなダイアリーの自動インポートによるアーカイブです。

Rubyのウェブブラウザ対応状況と、XHTML/CSS Ruby周りのメモ

間違ってもプログラミング言語rubyのお話ではありません。このタイトルで間違える人はいないと思いますが。

Rubyをそれっぽく表示させる

IEではデフォルトでそれっぽく表示してくれるけれども、それ以外のブラウザでは何も起きないので、適当に細工する必要がある。


Firefoxの場合はアドオンを入れてしまえばいい。

XHTMLルビサポート (XHTML Ruby Support)
https://addons.mozilla.org/ja/firefox/addon/1935
HTML Ruby
https://addons.mozilla.org/ja/firefox/addon/6812

どちらも大差ない思うけど、前者はおまけ的機能が付いていて、後者は比較的シンプル。私は前者の方が青空文庫は読みやすいと感じた。


我らが(?)Operaの場合はUserJSで。

HTML Ruby - sixteen nights
http://my.opera.com/kailapis/blog/html-ruby http://my.opera.com/Kai_Lapis/blog/html-ruby


Safariの場合はUserスタイルシートで。

ルビ表示はユーザスタイルシートで! - 徒書
http://www.akatsukinishisu.net/itazuragaki/css/use_ruby_style_as_user_stylesheet.html
Operaでルビをそれっぽく見せるユーザスタイルシート
http://kuruman.org/diary/2006/10/21/opera-ruby-css
rubyUserCSS - うそぴょん/ε∂.∂з\
http://my.opera.com/usopion/blog/2007/10/31/ruby-usercss

3つほど試したけど、徒書のものが一番しっくり来る感じ。


どんな感じになるかは、

I18N Test Suite: Ruby markup 2
http://www.w3.org/International/tests/sec-ruby-markup-2
芥川龍之介 地獄変 - 青空文庫
http://www.aozora.gr.jp/cards/000879/files/60_15129.html

あたりで確認してください。

W3C文章の大まかな流れ

2001-05 XHTMLモジュールとして、Ruby Annotationが勧告。

Ruby Annotation
http://www.w3.org/TR/2001/REC-ruby-20010531/
(邦訳)ルビ付注
http://www.doraneko.org/webauth/ruby/20010531/

2003-05 CSS3 RubyCRになる。

CSS3 Ruby Module
http://www.w3.org/TR/2003/CR-css3-ruby-20030514/

2008-10 日本語組版処理の要件のWDが2008-04版から更新。

日本語組版処理の要件(日本語版) 3.3 ルビと圏点処理
http://www.w3.org/TR/2008/WD-jlreq-20081015/ja/#ja-subheading2_3
Requirements of Japanese Text Layout 3.3 Ruby and Emphasis Dots
http://www.w3.org/TR/2008/WD-jlreq-20081015/#en-subheading2_3

:2009-02 現時点でのHTML5rubyはこんな感じ。

HTML 5 4.6.22 The ruby element
http://www.w3.org/TR/2009/WD-html5-20090212/text-level-semantics.html#the-ruby-element

おまけ

てきとーにW3Cメーリングリストをあさったらこんなものが。

(引用注:Text-Layoutの話題から)
   Alex: There's also a Ruby spec which could follow the same track.
   Alex: I'm less concerned about that
   Alex: As we only have partial implementation of Ruby spec
   Elika: We don't have an editor for that right now
   Anne: There are also some open ruby issues
   Alex: I wanted to mention that, but we don't have any current plans to
         advance that
   John: We have two developers in Japan (for Mozilla) who want to implement
         it, but say the spec is dodgy
[CSSWG] Minutes F2F 2008-08-21 from fantasai on 2008-09-09 (www-style@w3.org from September 2008)

ま、話のちゃんとした流れは元記事を見てもらうとして、興味深いのはMozilla方面のデベロッパが実装したがってるけど、仕様がアレ*1だと。いずれにせよ日本語組版処理の要件がRubyに関して大きな役割を担っていくのは間違いないっぽい。

*1:dodgyのちゃんとした訳は http://eow.alc.co.jp/dodgy/UTF-8/ あたりを参照