• R/O
  • SSH
  • HTTPS

copper: Commit


Commit MetaInfo

Revision1574 (tree)
Time2018-10-26 11:44:00
Authormiyabe

Log Message

(empty log message)

Change Summary

Incremental Difference

--- copper/trunk/homare/pom.xml (revision 1573)
+++ copper/trunk/homare/pom.xml (revision 1574)
@@ -9,7 +9,7 @@
99 <groupId>net.zamasoft</groupId>
1010 <artifactId>homare</artifactId>
1111 <packaging>jar</packaging>
12- <version>3.2.1</version>
12+ <version>3.2.2</version>
1313 <name>Homare</name>
1414 <description>印刷向けのHTML/CSSレンダリングエンジンです。</description>
1515 <url>http://copper.osdn.jp/homare/</url>
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/BreakAllHyphenation.java (nonexistent)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/BreakAllHyphenation.java (revision 1574)
@@ -0,0 +1,14 @@
1+package jp.cssj.homare.impl.css.lang;
2+
3+import jp.cssj.sakae.gc.text.hyphenation.Hyphenation;
4+
5+public class BreakAllHyphenation implements Hyphenation {
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+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/CSSJHyphenation.java (nonexistent)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/CSSJHyphenation.java (revision 1574)
@@ -0,0 +1,36 @@
1+package jp.cssj.homare.impl.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.JapaneseHyphenation;
6+
7+public class CSSJHyphenation extends JapaneseHyphenation {
8+ final private CSSJBreakRuleValue include;
9+ final private CSSJBreakRuleValue exclude;
10+
11+ public CSSJHyphenation(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+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/CSSJTextUnitizer.java (nonexistent)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/CSSJTextUnitizer.java (revision 1574)
@@ -0,0 +1,53 @@
1+package jp.cssj.homare.impl.css.lang;
2+
3+import java.util.ArrayList;
4+import java.util.List;
5+
6+import jp.cssj.homare.style.box.params.AbstractTextParams;
7+import jp.cssj.homare.style.builder.InlineQuad;
8+import jp.cssj.homare.style.builder.InlineQuad.InlineStartQuad;
9+import jp.cssj.sakae.gc.text.Quad;
10+import jp.cssj.sakae.gc.text.hyphenation.Hyphenation;
11+import jp.cssj.sakae.gc.text.hyphenation.impl.TextUnitizer;
12+
13+public class CSSJTextUnitizer extends TextUnitizer {
14+
15+ private List<Hyphenation> hyphStack = new ArrayList<Hyphenation>();;
16+
17+ public CSSJTextUnitizer(Hyphenation hyph) {
18+ super(hyph);
19+ this.hyphStack.add(hyph);
20+ }
21+
22+ public void quad(Quad quad) {
23+ if (quad instanceof InlineQuad) {
24+ final InlineQuad inlineQuad = (InlineQuad) quad;
25+ switch (inlineQuad.getType()) {
26+ case InlineQuad.INLINE_START: {
27+ final InlineStartQuad inlineStartQuad = (InlineStartQuad) inlineQuad;
28+ AbstractTextParams params = inlineStartQuad.box.getTextParams();
29+ this.hyphStack.add(params.hyphenation);
30+ this.setHyphenation(params.hyphenation);
31+ }
32+ break;
33+
34+ case InlineQuad.INLINE_END: {
35+ this.hyphStack.remove(this.hyphStack.size() - 1);
36+ final Hyphenation hyph = this.hyphStack.get(this.hyphStack.size() - 1);
37+ this.setHyphenation(hyph);
38+ }
39+ break;
40+
41+ case InlineQuad.INLINE_REPLACED:
42+ case InlineQuad.INLINE_BLOCK:
43+ case InlineQuad.INLINE_ABSOLUTE:
44+ break;
45+
46+ default:
47+ throw new IllegalStateException();
48+ }
49+ }
50+ super.quad(quad);
51+ }
52+
53+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/JapaneseKeepAllHyphenation.java (nonexistent)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/JapaneseKeepAllHyphenation.java (revision 1574)
@@ -0,0 +1,14 @@
1+package jp.cssj.homare.impl.css.lang;
2+
3+import java.lang.Character.UnicodeBlock;
4+
5+import jp.cssj.sakae.gc.text.hyphenation.impl.JapaneseHyphenation;
6+
7+public class JapaneseKeepAllHyphenation extends JapaneseHyphenation {
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+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/LanguageProfile_ja.java (revision 1573)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/lang/LanguageProfile_ja.java (revision 1574)
@@ -1,9 +1,6 @@
11 package jp.cssj.homare.impl.css.lang;
22
33 import jp.cssj.homare.css.CSSStyle;
4-import jp.cssj.homare.css.lang.BreakAllHyphenation;
5-import jp.cssj.homare.css.lang.CSSJHyphenation;
6-import jp.cssj.homare.css.lang.JapaneseKeepAllHyphenation;
74 import jp.cssj.homare.css.lang.LanguageProfile;
85 import jp.cssj.homare.css.value.QuotesValue;
96 import jp.cssj.homare.css.value.TextTransformValue;
--- copper/trunk/homare/src/main/java/jp/cssj/homare/style/box/impl/TextBlockBox.java (revision 1573)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/style/box/impl/TextBlockBox.java (revision 1574)
@@ -5,6 +5,7 @@
55 import java.util.ArrayList;
66 import java.util.List;
77
8+import jp.cssj.homare.impl.css.lang.CSSJTextUnitizer;
89 import jp.cssj.homare.style.box.AbstractBox;
910 import jp.cssj.homare.style.box.AbstractLineBox;
1011 import jp.cssj.homare.style.box.IFlowBox;
@@ -25,7 +26,6 @@
2526 import jp.cssj.sakae.gc.paint.RGBColor;
2627 import jp.cssj.sakae.gc.text.FilterGlyphHandler;
2728 import jp.cssj.sakae.gc.text.GlyphHandler;
28-import jp.cssj.sakae.gc.text.hyphenation.impl.TextUnitizer;
2929
3030 /**
3131 * テキストだけを含むことができるボックスです。
@@ -349,7 +349,7 @@
349349 assert (!this.lines.isEmpty());
350350 builder.setTextState(this.textState);
351351 final GlyphHandler gh = new BuilderGlyphHandler(builder);
352- final FilterGlyphHandler textUnitizer = new TextUnitizer(this.params.hyphenation);
352+ final FilterGlyphHandler textUnitizer = new CSSJTextUnitizer(this.params.hyphenation);
353353 textUnitizer.setGlyphHandler(gh);
354354 // System.err.println("*** start");
355355 for (int i = 0; i < this.lines.size(); ++i) {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/style/builder/impl/StyledTextUnitizer.java (revision 1573)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/style/builder/impl/StyledTextUnitizer.java (revision 1574)
@@ -4,6 +4,7 @@
44 import java.util.ArrayList;
55 import java.util.List;
66
7+import jp.cssj.homare.impl.css.lang.CSSJTextUnitizer;
78 import jp.cssj.homare.style.box.AbstractContainerBox;
89 import jp.cssj.homare.style.box.AbstractReplacedBox;
910 import jp.cssj.homare.style.box.IAbsoluteBox;
@@ -19,7 +20,6 @@
1920 import jp.cssj.sakae.gc.text.FilterGlyphHandler;
2021 import jp.cssj.sakae.gc.text.Glypher;
2122 import jp.cssj.sakae.gc.text.Quad;
22-import jp.cssj.sakae.gc.text.hyphenation.impl.TextUnitizer;
2323 import jp.cssj.sakae.gc.text.layout.control.LineBreak;
2424 import jp.cssj.sakae.gc.text.layout.control.Tab;
2525 import jp.cssj.sakae.gc.text.layout.control.WhiteSpace;
@@ -68,7 +68,7 @@
6868 return;
6969 }
7070 final AbstractTextParams params = this.getTextParams();
71- final FilterGlyphHandler textUnitizer = new TextUnitizer(params.hyphenation);
71+ final FilterGlyphHandler textUnitizer = new CSSJTextUnitizer(params.hyphenation);
7272 textUnitizer.setGlyphHandler(this.gh);
7373 this.glypher = params.fontManager.getGlypher();
7474 this.glypher.setGlyphHander(textUnitizer);
--- copper/trunk/homare/src/main/java/jp/cssj/homare/style/builder/impl/TwoPassBlockBuilder.java (revision 1573)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/style/builder/impl/TwoPassBlockBuilder.java (revision 1574)
@@ -4,6 +4,7 @@
44 import java.util.Iterator;
55 import java.util.List;
66
7+import jp.cssj.homare.impl.css.lang.CSSJTextUnitizer;
78 import jp.cssj.homare.style.box.AbstractBlockBox;
89 import jp.cssj.homare.style.box.AbstractContainerBox;
910 import jp.cssj.homare.style.box.AbstractReplacedBox;
@@ -43,7 +44,6 @@
4344 import jp.cssj.sakae.gc.text.Quad;
4445 import jp.cssj.sakae.gc.text.Text;
4546 import jp.cssj.sakae.gc.text.TextImpl;
46-import jp.cssj.sakae.gc.text.hyphenation.impl.TextUnitizer;
4747 import jp.cssj.sakae.gc.text.layout.control.LineBreak;
4848
4949 public class TwoPassBlockBuilder implements Builder, LayoutStack, TwoPass {
@@ -615,7 +615,7 @@
615615 switch (this.recordTypes.get(i)) {
616616 case TYPE_ELEMENT: {
617617 if (textUnitizer == null) {
618- textUnitizer = new TextUnitizer(builder.getFlowBox().getBlockParams().hyphenation);
618+ textUnitizer = new CSSJTextUnitizer(builder.getFlowBox().getBlockParams().hyphenation);
619619 textUnitizer.setGlyphHandler(new BuilderGlyphHandler(builder));
620620 }
621621 final Element e = (Element) k.next();
@@ -746,7 +746,7 @@
746746 case Types.AUTO_POSITION_INLINE:
747747 final Quad quad = InlineQuad.createInlineAbsoluteBoxQuad(absoluteBox);
748748 if (textUnitizer == null) {
749- textUnitizer = new TextUnitizer(builder.getFlowBox().getBlockParams().hyphenation);
749+ textUnitizer = new CSSJTextUnitizer(builder.getFlowBox().getBlockParams().hyphenation);
750750 textUnitizer.setGlyphHandler(new BuilderGlyphHandler(builder));
751751 }
752752 textUnitizer.quad(quad);
--- copper/trunk/homare/src/main/java/jp/cssj/homare/style/util/StyleUtils.java (revision 1573)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/style/util/StyleUtils.java (revision 1574)
@@ -26,6 +26,7 @@
2626 import jp.cssj.homare.ua.props.UAProps;
2727 import jp.cssj.sakae.gc.GC;
2828 import jp.cssj.sakae.gc.GraphicsException;
29+import jp.cssj.sakae.gc.font.FontFamilyList;
2930 import jp.cssj.sakae.gc.font.FontPolicyList;
3031 import jp.cssj.sakae.gc.text.TextLayoutHandler;
3132 import jp.cssj.sakae.gc.text.hyphenation.HyphenationBundle;
@@ -148,6 +149,7 @@
148149 lineHandler.setLineAdvance(width);
149150
150151 TextLayoutHandler tlf = new TextLayoutHandler(gc, HyphenationBundle.getHyphenation(null), lineHandler);
152+ tlf.setFontFamilies(FontFamilyList.SERIF);
151153 tlf.setFontPolicy(fontPolicy);
152154 tlf.setFontSize(fontSize);
153155 tlf.characters(text);
--- copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/font/otf/OpenTypeFontSource.java (revision 1573)
+++ copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/font/otf/OpenTypeFontSource.java (revision 1574)
@@ -118,6 +118,9 @@
118118 if (cmap == null) {
119119 cmap = ((CmapTable) ttFont.getTable(Table.cmap)).getCmapFormat(Table.platformMicrosoft, Table.encodingUCS2);
120120 }
121+ if (cmap == null) {
122+ cmap = ((CmapTable) ttFont.getTable(Table.cmap)).getCmapFormat(Table.platformAppleUnicode,(short)-1);
123+ }
121124 this.cmap = cmap;
122125 {
123126 int gid = this.cmap.mapCharCode(' ');
--- copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/font/FontFace.java (revision 1573)
+++ copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/font/FontFace.java (revision 1574)
@@ -6,6 +6,7 @@
66
77 public class FontFace {
88 public Source src = null;
9+ public int index = 0;
910 public Font local = null;
1011 public FontFamilyList fontFamily = null;
1112 public short fontWeight = FontStyle.FONT_WEIGHT_400;
@@ -15,8 +16,8 @@
1516 public String cmap = null, vcmap = null;
1617
1718 public String toString() {
18- return "src=" + this.src + "/local=" + this.local + "/fontFamily=" + this.fontFamily + "/fontWeight="
19- + this.fontWeight + "/fontStyle=" + this.fontStyle + "/unicodeRange=" + this.unicodeRange + "/panose="
20- + this.panose + "/cmap=" + this.cmap + "/vcmap=" + this.vcmap;
19+ return "src=" + this.src + "/local=" + this.local + "/index=" + this.index + "/fontFamily=" + this.fontFamily
20+ + "/fontWeight=" + this.fontWeight + "/fontStyle=" + this.fontStyle + "/unicodeRange="
21+ + this.unicodeRange + "/panose=" + this.panose + "/cmap=" + this.cmap + "/vcmap=" + this.vcmap;
2122 }
2223 }
--- copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/font/FontPolicyList.java (revision 1573)
+++ copper/trunk/sakae/sakae-core/src/main/java/jp/cssj/sakae/gc/font/FontPolicyList.java (revision 1574)
@@ -81,6 +81,9 @@
8181 case FONT_POLICY_EMBEDDED:
8282 buff.append("embedded ");
8383 break;
84+ case FONT_POLICY_OUTLINES:
85+ buff.append("outlines ");
86+ break;
8487 default:
8588 throw new IllegalStateException();
8689 }
--- copper/trunk/sakae/sakae-pdf/src/example/java/jp/cssj/sakae/example/FontTest.java (nonexistent)
+++ copper/trunk/sakae/sakae-pdf/src/example/java/jp/cssj/sakae/example/FontTest.java (revision 1574)
@@ -0,0 +1,18 @@
1+package jp.cssj.sakae.example;
2+
3+import java.awt.Font;
4+import java.io.File;
5+
6+import jp.cssj.sakae.font.otf.OpenTypeFontSource;
7+import jp.cssj.sakae.gc.font.FontStyle;
8+
9+/**
10+ * @author MIYABE Tatsuhiko
11+ * @version $Id: AlphaDemo.java 1565 2018-07-04 11:51:25Z miyabe $
12+ */
13+public class FontTest {
14+ public static void main(String[] args) throws Exception {
15+ File file = new File("Apple Symbols.ttf");
16+ OpenTypeFontSource otf = new OpenTypeFontSource(file, 0, FontStyle.DIRECTION_TB);
17+ }
18+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- copper/trunk/sakae/sakae-pdf/src/main/java/jp/cssj/sakae/pdf/font/PdfFontSourceManager.java (revision 1573)
+++ copper/trunk/sakae/sakae-pdf/src/main/java/jp/cssj/sakae/pdf/font/PdfFontSourceManager.java (revision 1574)
@@ -87,8 +87,8 @@
8787 this.uriToFile.put(face.src.getURI(), file);
8888 }
8989 }
90- FontLoader.readTTF(list, face, FontLoader.TYPE_EMBEDDED, file, 0, null);
91- FontLoader.readTTF(list, face, FontLoader.TYPE_CID_IDENTITY, file, 0, null);
90+ FontLoader.readTTF(list, face, FontLoader.TYPE_EMBEDDED, file, face.index, null);
91+ FontLoader.readTTF(list, face, FontLoader.TYPE_CID_IDENTITY, file, face.index, null);
9292 }
9393
9494 if (face.unicodeRange != null && !face.unicodeRange.isEmpty()) {
--- copper/trunk/sakae/zs-font/src/main/java/net/zamasoft/font/table/CmapTable.java (revision 1573)
+++ copper/trunk/sakae/zs-font/src/main/java/net/zamasoft/font/table/CmapTable.java (revision 1574)
@@ -60,7 +60,8 @@
6060 public CmapFormat getCmapFormat(short platformId, short encodingId) {
6161 // Find the requested format
6262 for (int i = 0; i < this.numTables; i++) {
63- if (this.entries[i].getPlatformId() == platformId && this.entries[i].getEncodingId() == encodingId) {
63+ if (this.entries[i].getPlatformId() == platformId
64+ && (encodingId == -1 || this.entries[i].getEncodingId() == encodingId)) {
6465 return this.formats[i];
6566 }
6667 }
@@ -67,6 +68,14 @@
6768 return null;
6869 }
6970
71+ public CmapFormat getCmapFormat(int ix) {
72+ return this.formats[ix];
73+ }
74+
75+ public int getTableCount() {
76+ return this.numTables;
77+ }
78+
7079 public int getType() {
7180 return cmap;
7281 }
Show on old repository browser