ASF Bugzilla – Attachment 35059 Details for
Bug 61169
Text with Japanese characters overflows textbox
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test class with registered font
TextBoxOverflow.java (text/x-java), 2.97 KB, created by
Andreas Beeker
on 2017-06-17 00:02:33 UTC
(
hide
)
Description:
Test class with registered font
Filename:
MIME Type:
Creator:
Andreas Beeker
Created:
2017-06-17 00:02:33 UTC
Size:
2.97 KB
patch
obsolete
>package org.apache.poi.xslf.usermodel; > >import java.awt.Color; >import java.awt.Font; >import java.awt.FontFormatException; >import java.awt.GraphicsEnvironment; >import java.awt.Rectangle; >import java.awt.font.TextAttribute; >import java.io.File; >import java.io.FileOutputStream; >import java.io.IOException; >import java.util.HashMap; >import java.util.Map; > >import org.apache.poi.sl.usermodel.StrokeStyle.LineDash; >import org.junit.Test; >import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun; > >public class TextBoxOverflow { > static final String jptext = > "\u3061\u3087\u3063\u3068\u65E9\u3044\u3051\u3069T\u30B7\u30E3\u30C4\u304C\u7740\u305F\u304F\u306A" > + "\u308B\u5B63\u7BC0\u2661\u304A\u6BCD\u3055\u3093\u306E\u5F71\u97FF\u304B\u3001\u975E\u5E38\u306B" > + "\u6050\u7ADC\u304C\u5927\u597D\u304D\u3067\u3059\u3002\u3082\u3046\u98FC\u3044\u305F\u3044\u304F" > + "\u3089\u3044\u5927\u597D\u304D\u3067\u3059\u3002#\u30B8\u30E5\u30E9\u30B7\u30C3\u30AF\u30EF\u30FC" > + "\u30EB\u30C9 \u306E\u30E9\u30D7\u30C8\u30EB4\u59C9\u59B9\u3068\u304B\u6FC0\u7684\u306B\u53EF\u611B" > + "\u304F\u3066\u53EF\u611B\u304F\u3066\u53EF\u611B\u304F\u3066\u53EF\u611B\u3044\u3067\u3059\u3002" > + "\u3081\u308D\u3081\u308D\u3001\u5927\u597D\u304D\u2661\u304A\u6BCD\u3055\u3093\u3082\u6050\u7ADC" > + "\u304C\u597D\u304D\u3067\u3001\u5C0F\u3055\u3044\u9803\u3001\u53E4\u4EE3\u751F\u7269\u306E\u56F3" > + "\u9451\u3092\u4E00\u7DD2\u306B\u898B\u3066\u305F\u306E\u601D\u3044\u51FA\u3059\u301C\u3068\u3044"; > > @Test > public void textbox() throws IOException, FontFormatException { > GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); > for (String s : new String[]{"mona.ttf"}) { > Font font = Font.createFont(Font.TRUETYPE_FONT, new File(s)); > Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>(); > attributes.put(TextAttribute.TRACKING, TextAttribute.TRACKING_LOOSE); > Font font2 = font.deriveFont(attributes); > ge.registerFont(font2); > } > > XMLSlideShow slideShow = new XMLSlideShow(); > > XSLFSlide slide = slideShow.createSlide(); > > XSLFTextBox textBox = slide.createTextBox(); > textBox.setLineColor(Color.black); > textBox.setLineDash(LineDash.SOLID); > textBox.setLineWidth(3); > textBox.setText(jptext); > for (XSLFTextParagraph p : textBox.getTextParagraphs()) { > for (XSLFTextRun r : p.getTextRuns()) { > r.setFontFamily("Mona"); > CTRegularTextRun tr = (CTRegularTextRun)r.getXmlObject(); > tr.getRPr().addNewEa().setTypeface("Mona"); > } > } > textBox.setAnchor(new Rectangle(50, 50, 200, 5000)); > textBox.resizeToFitText(); > > FileOutputStream out = new FileOutputStream("TextBoxOverflowWithJapanese.pptx"); > slideShow.write(out); > out.close(); > slideShow.close(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 61169
:
35041
|
35042
| 35059 |
35076