Fix signature and documentation

This commit is contained in:
Mikael Sand
2017-07-23 04:02:36 +03:00
parent 5b78c93c40
commit 2bb08d9f7a
2 changed files with 29 additions and 8 deletions
@@ -82,17 +82,38 @@ class PropHelper {
static private final Pattern percentageRegExp = Pattern.compile("^(-?\\d+(?:\\.\\d+)?)%$");
/**
* Converts length string into actual based on a relative number
*
* Converts length string into float value
* in the current user coordinate system
*
* @param length length string
* @param relative relative number
* @param offset offset number
* @param relative relative size for percentages
* @param offset offset for all units
* @param fontSize current font size
* @return actual float based on relative number
* @return value in the current user coordinate system
*/
static float fromRelativeToFloat(String length, float relative, float offset, float scale, float fontSize) {
/*
TODO list
static float fromRelativeToFloat(String length, float relative, float offset, float scale, double fontSize) {
unit relative to
em font size of the element
ex x-height of the elements font
ch width of the "0" (ZERO, U+0030) glyph in the elements font
rem font size of the root element
vw 1% of viewports width
vh 1% of viewports height
vmin 1% of viewports smaller dimension
vmax 1% of viewports larger dimension
relative-size [ larger | smaller ]
absolute-size: [ xx-small | x-small | small | medium | large | x-large | xx-large ]
https://www.w3.org/TR/css3-values/#relative-lengths
https://www.w3.org/TR/css3-values/#absolute-lengths
https://drafts.csswg.org/css-cascade-4/#computed-value
https://drafts.csswg.org/css-fonts-3/#propdef-font-size
https://drafts.csswg.org/css2/fonts.html#propdef-font-size
*/
length = length.trim();
int stringLength = length.length();
int percentIndex = stringLength - 1;
@@ -112,7 +133,7 @@ class PropHelper {
break;
case "em":
unit = (float) fontSize;
unit = fontSize;
break;
/*
@@ -132,7 +132,7 @@ class TSpanShadowNode extends TextShadowNode {
if (textPath != null) {
pm = new PathMeasure(textPath.getPath(), false);
distance = pm.getLength();
double size = getFontSizeFromContext();
float size = gc.getFontSize();
String startOffset = textPath.getStartOffset();
offset = PropHelper.fromRelativeToFloat(startOffset, distance, 0, mScale, size);
// String spacing = textPath.getSpacing(); // spacing = "auto | exact"