A DESCRIPTION OF THE REQUEST :
in PrismTextLayout,
private float getTabAdvance() {
float spaceAdvance = 0;
if (spans != null) {
/* Rich text case - use the first font (for now) */
for (int i = 0; i < spans.length; i++) {
TextSpan span = spans[i];
PGFont font = (PGFont)span.getFont();
if (font != null) {
FontStrike strike = font.getStrike(IDENTITY);
spaceAdvance = strike.getCharAdvance(' ');
break;
}
}
} else {
spaceAdvance = strike.getCharAdvance(' ');
}
return 8 * spaceAdvance;
}
note the 8 * spaceAdvance, unable to be changed in runtime.
JUSTIFICATION :
Many text editors run a 4 * (width of space) so this can cause unintended graphical mistranslations when trying to upgrade software into JavaFX.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Some method e.g. TextLayout.setTabWidth() that allows us to modify the width of the tab, in spaces.
ACTUAL -
No such method provided; locked into using 8-width tabs
---------- BEGIN SOURCE ----------
TextFlow flow = new TextFlow();
flow.getChildren().add(new Text(" There is a tab before this text.\n There are four spaces before this text.\n There are eight spaces before this text"));
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
n/a, security privileges prevent injecting code into the JRE. The only option is to render tabs by converting tabs into a series of spaces but this is difficult to implement.
in PrismTextLayout,
private float getTabAdvance() {
float spaceAdvance = 0;
if (spans != null) {
/* Rich text case - use the first font (for now) */
for (int i = 0; i < spans.length; i++) {
TextSpan span = spans[i];
PGFont font = (PGFont)span.getFont();
if (font != null) {
FontStrike strike = font.getStrike(IDENTITY);
spaceAdvance = strike.getCharAdvance(' ');
break;
}
}
} else {
spaceAdvance = strike.getCharAdvance(' ');
}
return 8 * spaceAdvance;
}
note the 8 * spaceAdvance, unable to be changed in runtime.
JUSTIFICATION :
Many text editors run a 4 * (width of space) so this can cause unintended graphical mistranslations when trying to upgrade software into JavaFX.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Some method e.g. TextLayout.setTabWidth() that allows us to modify the width of the tab, in spaces.
ACTUAL -
No such method provided; locked into using 8-width tabs
---------- BEGIN SOURCE ----------
TextFlow flow = new TextFlow();
flow.getChildren().add(new Text(" There is a tab before this text.\n There are four spaces before this text.\n There are eight spaces before this text"));
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
n/a, security privileges prevent injecting code into the JRE. The only option is to render tabs by converting tabs into a series of spaces but this is difficult to implement.
- csr for
-
JDK-8233810 Add tabSize property to Text and TextFlow
- Closed
- relates to
-
JDK-8236438 Add demo program for Text and TextFlow showing use of tabSize property
- Open
- links to
-
Commit openjdk/jfx/8367e1a6