• R/O
  • SSH
  • HTTPS

copper: Commit


Commit MetaInfo

Revision1573 (tree)
Time2018-07-11 16:23:19
Authormiyabe

Log Message

(empty log message)

Change Summary

  • delete: copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/BreakAllBindingRule.java
  • delete: copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/JapaneseKeepAllBindingRule.java
  • delete: copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/CSSJBindingRule.java
  • delete: copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/BindingRule.java
  • delete: copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/DefaultTextUnitizer.java
  • delete: copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/DefaultHyphenation.java
  • delete: copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/JapaneseBindingRule.java

Incremental Difference

--- copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/BreakAllBindingRule.java (revision 1572)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/BreakAllBindingRule.java (nonexistent)
@@ -1,14 +0,0 @@
1-package jp.cssj.homare.css.lang;
2-
3-import jp.cssj.sakae.gc.text.hyphenation.impl.BindingRule;
4-
5-public class BreakAllBindingRule implements BindingRule {
6- public boolean atomic(char c1, char c2) {
7- return false;
8- }
9-
10- public boolean canSeparate(char c1, char c2) {
11- return true;
12- }
13-
14-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/JapaneseKeepAllBindingRule.java (revision 1572)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/JapaneseKeepAllBindingRule.java (nonexistent)
@@ -1,14 +0,0 @@
1-package jp.cssj.homare.css.lang;
2-
3-import java.lang.Character.UnicodeBlock;
4-
5-import jp.cssj.sakae.gc.text.hyphenation.impl.JapaneseBindingRule;
6-
7-public class JapaneseKeepAllBindingRule extends JapaneseBindingRule {
8- public boolean atomic(char c1, char c2) {
9- if (this.isCJK(c1) && this.isCJK(c2) && UnicodeBlock.of(c1) != UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION) {
10- return true;
11- }
12- return super.atomic(c1, c2);
13- }
14-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/CSSJBindingRule.java (revision 1572)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/css/lang/CSSJBindingRule.java (nonexistent)
@@ -1,36 +0,0 @@
1-package jp.cssj.homare.css.lang;
2-
3-import jp.cssj.homare.css.value.ext.CSSJBreakRuleValue;
4-import jp.cssj.sakae.gc.text.hyphenation.impl.CharacterSet;
5-import jp.cssj.sakae.gc.text.hyphenation.impl.JapaneseBindingRule;
6-
7-public class CSSJBindingRule extends JapaneseBindingRule {
8- final private CSSJBreakRuleValue include;
9- final private CSSJBreakRuleValue exclude;
10-
11- public CSSJBindingRule(CSSJBreakRuleValue include, CSSJBreakRuleValue exclude) {
12- this.include = include;
13- this.exclude = exclude;
14- }
15-
16- protected CharacterSet requiresBefore(char c) {
17- if (this.include.getHead().indexOf(c) != -1) {
18- return CharacterSet.ALL;
19- }
20- if (this.exclude.getHead().indexOf(c) != -1) {
21- return CharacterSet.NOTHING;
22- }
23- return super.requiresBefore(c);
24- }
25-
26- protected CharacterSet requiresAfter(char c) {
27- if (this.include.getTail().indexOf(c) != -1) {
28- return CharacterSet.ALL;
29- }
30- if (this.exclude.getTail().indexOf(c) != -1) {
31- return CharacterSet.NOTHING;
32- }
33- return super.requiresAfter(c);
34- }
35-
36-}
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
--- copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/BindingRule.java (revision 1572)
+++ copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/BindingRule.java (nonexistent)
@@ -1,7 +0,0 @@
1-package jp.cssj.sakae.gc.text.hyphenation.impl;
2-
3-public interface BindingRule {
4- public boolean atomic(char c1, char c2);
5-
6- public boolean canSeparate(char c1, char c2);
7-}
\ No newline at end of file
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/DefaultTextUnitizer.java (revision 1572)
+++ copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/DefaultTextUnitizer.java (nonexistent)
@@ -1,123 +0,0 @@
1-package jp.cssj.sakae.gc.text.hyphenation.impl;
2-
3-import jp.cssj.sakae.gc.font.FontMetrics;
4-import jp.cssj.sakae.gc.font.FontStyle;
5-import jp.cssj.sakae.gc.text.FilterGlyphHandler;
6-import jp.cssj.sakae.gc.text.GlyphHandler;
7-import jp.cssj.sakae.gc.text.Quad;
8-
9-/**
10- * @author MIYABE Tatsuhiko
11- * @version $Id: AbstractHyphenation.java,v 1.11 2006/09/06 04:32:46 harumanx
12- * Exp $
13- */
14-class DefaultTextUnitizer implements FilterGlyphHandler {
15- private final BindingRule bindingRule;
16-
17- private GlyphHandler glyphHandler;
18-
19- /**
20- * Previous character.
21- */
22- private char prevChar = 0;
23-
24- private Quad beforeQuad = null;
25-
26- public DefaultTextUnitizer(BindingRule bindingRule) {
27- this.bindingRule = bindingRule;
28- }
29-
30- public void setGlyphHandler(GlyphHandler glyphHandler) {
31- this.glyphHandler = glyphHandler;
32- }
33-
34- public void startTextRun(int charOffset, FontStyle fontStyle, FontMetrics fontMetrics) {
35- this.glyphHandler.startTextRun(charOffset, fontStyle, fontMetrics);
36- }
37-
38- public void endTextRun() {
39- this.glyphHandler.endTextRun();
40- }
41-
42- public void glyph(int charOffset, char[] ch, int coff, byte clen, int gid) {
43- char c1 = ch[coff];
44- char c2 = ch[coff + clen - 1];
45- this.nextGlyph(c1, c2, clen);
46- if (this.beforeQuad != null) {
47- this.glyphHandler.quad(this.beforeQuad);
48- this.beforeQuad = null;
49- }
50- this.glyphHandler.glyph(charOffset, ch, coff, clen, gid);
51- }
52-
53- public void quad(Quad quad) {
54- String str = quad.getString();
55- if (str == Quad.BREAK) {
56- // CONTINUE_BEFORE, CONTINUE_AFTERを除いて文字列を区切る
57- if (this.prevChar != 0 && this.prevChar != '\u2060') {
58- this.internalFlush();
59- }
60- this.prevChar = '\u200B';
61- } else if (str == Quad.CONTINUE_BEFORE) {
62- // 前の文字として扱う(後の文字列にくっつける<span>...)
63- if (this.prevChar == '\u200B') {
64- this.internalFlush();
65- this.prevChar = '\u2060';
66- } else {
67- if (this.beforeQuad != null) {
68- this.glyphHandler.quad(this.beforeQuad);
69- }
70- this.beforeQuad = quad;
71- return;
72- }
73- } else if (str == Quad.CONTINUE_AFTER) {
74- // 前の文字として扱う(前の文字列にくっつける...</span>)
75- } else if (str.length() == 0) {
76- // 前の文字として扱う(前後にくっつける)
77- if (this.prevChar == '\u200B') {
78- this.internalFlush();
79- }
80- this.prevChar = '\u2060';
81- } else {
82- // 相当する文字列を使う
83- int strlen = str.length();
84- char c1 = str.charAt(0);
85- char c2 = str.charAt(strlen - 1);
86- this.nextGlyph(c1, c2, strlen);
87- }
88- if (this.beforeQuad != null) {
89- this.glyphHandler.quad(this.beforeQuad);
90- this.beforeQuad = null;
91- }
92- this.glyphHandler.quad(quad);
93- }
94-
95- private void internalFlush() {
96- this.glyphHandler.flush();
97- }
98-
99- public void flush() {
100- if (this.beforeQuad != null) {
101- this.glyphHandler.quad(this.beforeQuad);
102- this.beforeQuad = null;
103- }
104- this.internalFlush();
105- }
106-
107- /**
108- *
109- * @param c1
110- * グリフに対応する最初の文字。
111- * @param c2
112- * グリフに対応する最後の文字。
113- * @param charCount
114- * 文字数
115- */
116- private void nextGlyph(char c1, char c2, int charCount) {
117- if (this.prevChar != 0 && this.prevChar != '\u2060'
118- && (this.prevChar == '\u200B' || !this.bindingRule.atomic(this.prevChar, c1))) {
119- this.internalFlush();
120- }
121- this.prevChar = c2;
122- }
123-}
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/DefaultHyphenation.java (revision 1572)
+++ copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/DefaultHyphenation.java (nonexistent)
@@ -1,20 +0,0 @@
1-package jp.cssj.sakae.gc.text.hyphenation.impl;
2-
3-import jp.cssj.sakae.gc.text.FilterGlyphHandler;
4-import jp.cssj.sakae.gc.text.hyphenation.Hyphenation;
5-
6-public class DefaultHyphenation implements Hyphenation {
7- private final BindingRule bindingRule;
8-
9- public DefaultHyphenation(BindingRule bindingRule) {
10- this.bindingRule = bindingRule;
11- }
12-
13- public FilterGlyphHandler getTextUnitizer() {
14- return new DefaultTextUnitizer(this.bindingRule);
15- }
16-
17- public boolean canSeparate(char c1, char c2) {
18- return this.bindingRule.canSeparate(c1, c2);
19- }
20-}
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/JapaneseBindingRule.java (revision 1572)
+++ copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/text/hyphenation/impl/JapaneseBindingRule.java (nonexistent)
@@ -1,154 +0,0 @@
1-package jp.cssj.sakae.gc.text.hyphenation.impl;
2-
3-import java.lang.Character.UnicodeBlock;
4-
5-/**
6- * @author MIYABE Tatsuhiko
7- * @version $Id$
8- */
9-public class JapaneseBindingRule implements BindingRule {
10- private static final CharacterSet ASCII = new BitSetCharacterSet(
11- "#$%&*+-/0123456789=@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_abcdefghijklmnopqrstuvwxyz|~");
12-
13- /**
14- * 半角英数字。
15- */
16- private static final CharacterSet LATIN_OR_DIGIT = new CharacterSet() {
17- public boolean contains(char c) {
18- if (c > 0xFF) {
19- return false;
20- }
21- if (c > 0x7F) {
22- return true;
23- }
24- return ASCII.contains(c);
25- }
26- };
27-
28- /** 行頭禁則和字(SPEC JIS-X4051 8.1.1 + 独自。 */
29- private static final String GYOTO_KINSOKU = "~〜ヽヾゝゞ ー ァ ィ ゥ ェ ォ ッ ャ ュ ョ ヮ ヵ ヶ ぁ ぃ ぅ ぇ ぉ っ ゃ ゅ ょ ゎ ゕ ゖ ㇰ ㇱ ㇳ ㇲ ㇳ ㇴ ㇵ ㇶ ㇷ ㇸ ㇹ ㇺ ㇻ ㇼ ㇽ ㇾ ㇿ 々 〻\u3000・”";
30- /** 間違って行頭禁則とされてしまう圏点記号を除外。 */
31- private static final String GYOTO_KINSOKU_EX = "\uFE45\uFE46";
32-
33- /**
34- * 行頭禁則処理。 SPEC JIS-X4051 7.3
35- */
36- protected CharacterSet requiresBefore(char c) {
37- // 行頭禁則
38- if (GYOTO_KINSOKU.indexOf(c) != -1) {
39- return CharacterSet.ALL;
40- }
41- if (GYOTO_KINSOKU_EX.indexOf(c) != -1) {
42- return CharacterSet.NOTHING;
43- }
44- int type = Character.getType(c);
45-
46- switch (type) {
47- case Character.END_PUNCTUATION:
48- case Character.OTHER_PUNCTUATION:
49- case Character.MODIFIER_LETTER:
50- case Character.MODIFIER_SYMBOL:
51- // 終了括弧、区切り記号、修飾文字、修飾記号の前には文字が必要。
52- return CharacterSet.ALL;
53- }
54- return CharacterSet.NOTHING;
55- }
56-
57- /**
58- * 行末禁則処理。 SPEC JIS-X4051 7.4
59- */
60- protected CharacterSet requiresAfter(char c) {
61- int type = Character.getType(c);
62-
63- if (c <= 0xFF || LATIN_OR_DIGIT.contains(c)) {
64- // 半角英数
65- switch (type) {
66- case Character.START_PUNCTUATION:
67- // 開始括弧の後には何らかの文字が必要。
68- return CharacterSet.ALL;
69-
70- case Character.END_PUNCTUATION:
71- // 終了括弧の後には文字が不要。
72- return CharacterSet.NOTHING;
73-
74- default:
75- if (c == '\u0020' || c == '-' || c == '!' || c == '?') {
76- // 区切りの後ではラップできる。
77- return CharacterSet.NOTHING;
78- }
79- // 英数字の後には英数字が必要。
80- return LATIN_OR_DIGIT;
81- }
82- } else {
83- // その他の文字
84- switch (type) {
85- case Character.START_PUNCTUATION:
86- // 開始括弧の後には何らかの文字が必要。
87- return CharacterSet.ALL;
88- }
89- // ダッシュ等
90- if (c == '─' || c == '“') {
91- return CharacterSet.ALL;
92- }
93- }
94- return CharacterSet.NOTHING;
95- }
96-
97- public boolean atomic(char c1, char c2) {
98- return this.requiresAfter(c1).contains(c2) || this.requiresBefore(c2).contains(c1);
99- }
100-
101- public boolean canSeparate(char c1, char c2) {
102- if (Character.isWhitespace(c1) || Character.isWhitespace(c2)) {
103- return c1 != '\u3000';
104- }
105- if (this.isCJK(c1) || this.isCJK(c2)) {
106- return true;
107- }
108- return false;
109- }
110-
111- protected boolean isCJK(char c) {
112- UnicodeBlock b = UnicodeBlock.of(c);
113- if (b == null) {
114- return true;
115- }
116- if (b == UnicodeBlock.CJK_COMPATIBILITY) {
117- return true;
118- }
119- if (b == UnicodeBlock.CJK_COMPATIBILITY_FORMS) {
120- return true;
121- }
122- if (b == UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS) {
123- return true;
124- }
125- if (b == UnicodeBlock.CJK_RADICALS_SUPPLEMENT) {
126- return true;
127- }
128- if (b == UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION) {
129- return true;
130- }
131- if (b == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) {
132- return true;
133- }
134- if (b == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A) {
135- return true;
136- }
137- if (b == UnicodeBlock.HIRAGANA) {
138- return true;
139- }
140- if (b == UnicodeBlock.KATAKANA) {
141- return true;
142- }
143- if (b == UnicodeBlock.HANGUL_SYLLABLES) {
144- return true;
145- }
146- if (b == UnicodeBlock.HANGUL_JAMO) {
147- return true;
148- }
149- if (b == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO) {
150- return true;
151- }
152- return false;
153- }
154-}
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Show on old repository browser