Comments (4)
Perhaps you can set lineRotation
on the TextBlockTextRenderer
, and also set textRotation
on the ElementFormat
.
from feathersui-starling.
Perhaps you can set
lineRotation
on theTextBlockTextRenderer
, and also settextRotation
on theElementFormat
.
Yes, I already tried it. If I used tf_block.lineRotation = TextRotation.ROTATE_90, get result like this.All character lined up and overlapped.
If use tf_block.lineRotation = TextRotation.ROTATE_90 and _format.textRotation = TextRotation.ROTATE_90, the TextBlockTextRenderer is invisible.
I don't see any code about vertical alignment in TextBlockTextRenderer source code.
var _fontColor:uint = 0x0;
var _fontSize:uint = 30;
var _fontFamily:String = "微软雅黑,Arial,_sans";
var _font:FontDescription = new FontDescription();
_font.fontLookup = FontLookup.DEVICE;
_font.fontName = _fontFamily;
//_font.cffHinting = CFFHinting.HORIZONTAL_STEM;
//_font.renderingMode = RenderingMode.CFF;
//_font.fontWeight = _fontWeight;
//_font.fontPosture = _fontPosture;
var _format:ElementFormat = new ElementFormat();
_format.color = _fontColor;
_format.fontSize = _fontSize;
//_format.fontDescription = _font;
_format.textRotation = TextRotation.AUTO;
//_format.textRotation = TextRotation.ROTATE_90;
_format.breakOpportunity = BreakOpportunity.ANY;
_format.locale = "zh";
var tf_block:TextBlockTextRenderer = new TextBlockTextRenderer();
tf_block.elementFormat = _format;
tf_block.textAlign = HorizontalAlign.LEFT;
tf_block.wordWrap = true;
tf_block.lineRotation = TextRotation.ROTATE_90;
tf_block.textJustifier = new EastAsianJustifier("ja", LineJustification.ALL_BUT_MANDATORY_BREAK, JustificationStyle.PUSH_IN_KINSOKU);
addChild(tf_block);
tf_block.width = 100;
tf_block.text = " 關關雎鳩,在河之洲。窈窕淑女,君子好逑。參差荇菜,左右流之。窈窕淑女,寤寐求之。求之不得,寤寐思服。悠哉悠哉,輾轉反側。參差荇菜,左右采之。窈窕淑女,琴瑟友之。參差荇菜,左右芼之。窈窕淑女,鐘鼓樂之。";
from feathersui-starling.
I'm afraid that I don't have any more suggestions. TextBlockTextRenderer is basically just a wrapper around Flash Text Engine, so you should look at Adobe's documentation for FTE for help.
You are also welcome to start a forum thread to potentially get help from the community.
from feathersui-starling.
One suggestion would be to take a look at the sample code in my old extension that also wrapped FTE. https://wiki.starling-framework.org/extensions/tlfsprite
https://gist.github.com/jamikado/3167820#file_tlf_sprite_snippets.as You don't need to switch to TLFSprite but just try and set the same FTE settings on the text formatter when using TextBlockTextRenderer to use east asian justifucation styles.... here is a snippet that did the vertical layout sample:
EDIT: On second thought this might be using TLF APIs so you might be better off switching to use TLFTextRenderer instead https://forum.starling-framework.org/d/7825-feathers-tlf-text-renderer
// Define east asian ideographic layout and formatting
// along with enforced composition height limit
textLayoutFormat = new TextLayoutFormat();
// define Japanese text in a string of Unicode characters
var jaText:String = String.fromCharCode(
0x30AF, 0x30ED, 0x30B9, 0x30D7, 0x30E9, 0x30C3, 0x30C8, 0x30D5,
0x30A9, 0x30FC, 0x30E0, 0x4E0A, 0x3067, 0x518D, 0x751F, 0x53EF,
0x80FD, 0x306A) +
"Flash Video" +
String.fromCharCode(
0x3092, 0x914D, 0x4FE1, 0x3001, 0x653F, 0x5E9C, 0x6700, 0x65B0,
0x60C5, 0x5831, 0x3092, 0x3088, 0x308A, 0x591A, 0x304F, 0x306E,
0x56FD, 0x6C11, 0x306B, 0x9AD8, 0x54C1, 0x8CEA, 0x306A, 0x753B,
0x50CF, 0x3067, 0x7C21, 0x5358, 0x304B, 0x3064, 0x30EA, 0x30A2,
0x30EB, 0x30BF, 0x30A4, 0x30E0, 0x306B, 0x63D0, 0x4F9B, 0x3059,
0x308B, 0x3053, 0x3068, 0x304C, 0x53EF, 0x80FD, 0x306B, 0x306A,
0x308A, 0x307e, 0x3057, 0x305F, 0x3002);
textLayoutFormat.locale = "ja";
if (Capabilities.os.search("Mac OS") > -1)
textLayoutFormat.fontFamily = String.fromCharCode(0x5C0F, 0x585A, 0x660E, 0x671D) + " Pro R"; // "Kozuka Mincho Pro R"
else
textLayoutFormat.fontFamily = "Kozuka Mincho Pro R";
// specify right-to-left block progression, east Asian justification, and top vertical alignment
textLayoutFormat.blockProgression = BlockProgression.RL;
textLayoutFormat.justificationRule = JustificationRule.EAST_ASIAN;
textLayoutFormat.verticalAlign = VerticalAlign.TOP;
textLayoutFormat.fontSize = 18;
from feathersui-starling.
Related Issues (20)
- Hidden rendering bug
- Null Object Reference when removing feathers control while parent is added to stage HOT 1
- BottomDrawerPopUpContentManager ignored panel.headerFactory
- Callout at borderline forgets to override arrowSkin
- LayoutGroup visible property HOT 11
- Is that a way to position the 'Toast' on top? HOT 1
- SoundChannelPeakVisualizer Implementation HOT 2
- VideoPlayer and screen rotation. HOT 2
- Error #1009 on Scroller/focusOutHandler HOT 2
- Default scale factor of MetalWorksDesktopTheme? HOT 1
- SDK Manager HOT 1
- TextInput width changes from focus in / focus out - Android Only HOT 8
- extending the Label class HOT 4
- Object not removed from Stage on Android - Starling maybe? HOT 1
- VerticalLayout without virtual layout throws error on drag/drop HOT 2
- TextInput promptTextRenderer has no stateContext added
- Getting quite a few of these 3768 HOT 4
- Space triggers the last pressed button HOT 2
- Possible minor tweening issue in `BaseEffectContext` @ `playReverse()` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feathersui-starling.