cjk

The best way to do Vertical text for CJK characters?

我是研究僧i 提交于 2019-12-01 13:09:47
As you may know, in mainland China, Taiwan, Japan and Korean, people sometimes writing and reading in vertical directions, here's a simple example : Years ago, there're no way to do so. Well, at least no beautiful methods, you know at that time one of the popular ways is: one div for each character. Since organizations like W3 truely made some effort these years, I'm wondering is there any better way to do so. I've found some attributes about text-directions in the standard docs, but I really wants to know about the IN FACT things like compatibility and so on. I'd like to accept answers with

The best way to do Vertical text for CJK characters?

风流意气都作罢 提交于 2019-12-01 10:03:25
问题 As you may know, in mainland China, Taiwan, Japan and Korean, people sometimes writing and reading in vertical directions, here's a simple example: Years ago, there're no way to do so. Well, at least no beautiful methods, you know at that time one of the popular ways is: one div for each character. Since organizations like W3 truely made some effort these years, I'm wondering is there any better way to do so. I've found some attributes about text-directions in the standard docs, but I really

Any libraries to convert number Pinyin to Pinyin with tone markings?

半城伤御伤魂 提交于 2019-12-01 09:18:54
Just wondering if anyone knows of a class library that can convert Chinese Pinyin to ones with tones, such as nin2 hao3 ma to nín hǎo ma. It would be similar to this answer , but hopefully using the .NET framework. Jhayes2118 Here is my porting of @Greg-Hewgill python algorithm to C#. I haven't run into any issues so far. public static string ConvertNumericalPinYinToAccented(string input) { Dictionary<int, string> PinyinToneMark = new Dictionary<int, string> { {0, "aoeiuv\u00fc"}, {1, "\u0101\u014d\u0113\u012b\u016b\u01d6\u01d6"}, {2, "\u00e1\u00f3\u00e9\u00ed\u00fa\u01d8\u01d8"}, {3, "\u01ce

How to get the length of Japanese characters in Javascript?

浪子不回头ぞ 提交于 2019-12-01 05:58:49
I have an ASP Classic page with SHIFT_JIS charset. The meta tag under the page's head section is like this: <meta http-equiv="Content-Type" content="text/html; charset=shift_jis"> My page has a text box (txtName) that should only allow 200 characters. I have a Javascript function that validates the character length, which is called on the onclick() event of my Submit button. if(document.frmPage.txtName.value.length > 200) { alert("You have exceeded the maximum length of 200."); return false; } The problem is, Javascript is not getting the correct length of Japanese character encoded in SHIFT

Manipulating utf8mb4 data from MySQL with PHP

限于喜欢 提交于 2019-12-01 05:39:15
This is probably something simple. I swear I've been looking online for the answer and haven't found it. Since my particular case is a little atypical I finally decided to ask here. I have a few tables in MySQL that I'm using for a Chinese language program. It needs to be able to support every possible Chinese character, including rare ones that don't have great font support. A sample cell in the table might be this: 東菄鶇䍶𠍀倲𩜍𢘐涷蝀凍鯟𢔅崠埬𧓕䰤 In order to get that to work right in the database, I've had to set the encoding/collation to utf8mb4. So far so good. Unfortunately when I pull the same string

Adjust the vertical positioning of ruby text

人盡茶涼 提交于 2019-12-01 04:52:15
I'd like to use HTML <ruby> to mark up Japanese text with its pronunciation. However, I've found that at large font sizes, the baseline of the <rt> text is well above the top of the characters it's marking up. Here's an example which shows what I mean: ruby { font-size: 72pt; } <ruby>遅<rt>おそ</rt>い</ruby> For reference, this is how it appears in my current browser (Firefox on Linux), though I've seen similar behavior in other browsers: What I would like is to adjust the height of the ruby text to be something more like this: However, nothing I try seems to have any effect on the positioning of

Validate Japanese Character in Active Record Callback

巧了我就是萌 提交于 2019-12-01 04:38:01
I have a Japanese project that needs to validate a half width and full width Japanese character, 14 chars are allowed on half width and 7 characters on full width. Is there anyone who knows how to implement that? Right now on my model class Customer validates_length_of :name, :maximum => 14 end is not a good choice I'm currently using ror 2.3.5 Both fullwidth and halfwidth can be used The following code may just push you over the line to fulfil the exact requirement you've so far specified in the least possible time . It uses the Moji gem ( Japanese documentation ), which gives lots of

Regex for Matching Pinyin

强颜欢笑 提交于 2019-12-01 04:17:32
I'm looking for a regular expression that can correctly match valid pinyin (e.g. "sheng", "sou" (while ignoring invalid pinyin, e.g. "shong", "sei"). Most of the regex provided in the top Google results match invalid pinyin in some cases. Obviously, no matter what approach one takes, this will be a monster regex, and I'm especially interested in the different approaches one could take to solve this problem. For example, " Optimizing a regular expression to parse chinese pinyin " uses lookbacks. A table of valid pinyin can be found here: http://pinyin.info/rules/initials_finals.html I went for

Drawing multilingual text using PIL

吃可爱长大的小学妹 提交于 2019-12-01 02:49:40
I'm having trouble drawing multilingual text using PIL. Let's say I want to draw text - "ひらがな - Hiragana, 히라가나". But PIL's ImageDraw.text() function takes only one font at a time, so I cannot draw this text correctly, because it requires English, Japanese, and Korean fonts all together. So far, I had no luck finding a simple solution like passing multiple fonts to PIL, so that it can choose appropriate font for each Unicode character (Like modern SDK or web browsers do). What I'm thinking is, I should iterate over each character, and determine which font to use for each character by myself.

Validate Japanese Character in Active Record Callback

妖精的绣舞 提交于 2019-12-01 02:25:10
问题 I have a Japanese project that needs to validate a half width and full width Japanese character, 14 chars are allowed on half width and 7 characters on full width. Is there anyone who knows how to implement that? Right now on my model class Customer validates_length_of :name, :maximum => 14 end is not a good choice I'm currently using ror 2.3.5 Both fullwidth and halfwidth can be used 回答1: The following code may just push you over the line to fulfil the exact requirement you've so far