public class CssUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
compareFloats(double d1, double d2)
Helper method for comparing floating point numbers
|
static boolean |
compareFloats(float f1, float f2)
Helper method for comparing floating point numbers
|
static double |
convertPtsToPx(double pts)
Convert given point value to a pixel value.
|
static float |
convertPtsToPx(float pts)
Convert given point value to a pixel value.
|
static double |
convertPxToPts(double px)
Convert given point value to a point value.
|
static float |
convertPxToPts(float px)
Convert given point value to a point value.
|
static int |
determinePositionBetweenValueAndUnit(String string)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.determinePositionBetweenValueAndUnit(String) instead
|
static String |
extractAttributeValue(String attrStr, IElementNode element)
Parses string and return attribute value.
|
static List<List<String>> |
extractShorthandProperties(String str)
Extracts shorthand properties as list of string lists from a string, where the top level list is shorthand property and the lower level list is properties included in shorthand property.
|
static String |
extractUrl(String url)
Parses url("file.jpg") to file.jpg .
|
static int |
findNextUnescapedChar(String source, char ch, int startIndex)
Find the next unescaped character.
|
static boolean |
isAngleValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isAngleValue(String) instead
|
static boolean |
isBase64Data(String data)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isBase64Data(String) method instead
|
static boolean |
isColorProperty(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isColorProperty(String) method instead
|
static boolean |
isEmValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isEmValue(String) method instead
|
static boolean |
isExValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isExValue(String) method instead
|
static boolean |
isFontRelativeValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isRelativeValue(String) method instead
|
static boolean |
isInitialOrInheritOrUnset(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isInitialOrInheritOrUnset(String) method instead
|
static boolean |
isMetricValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isMetricValue(String) instead
|
static boolean |
isNegativeValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isNegativeValue(String) method instead
|
static boolean |
isNumericValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isNumericValue(String) method instead
|
static boolean |
isPercentageValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isPercentageValue(String) method instead
|
static boolean |
isRelativeValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isRelativeValue(String) instead
|
static boolean |
isRemValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isRemValue(String) method instead
|
static boolean |
isStyleSheetLink(IElementNode headChildElement)
Checks if an IElementNode represents a style sheet link.
|
static boolean |
isValidNumericValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isValidNumericValue(String) instead
|
static String |
normalizeCssProperty(String str)
Normalizes a CSS property.
|
static float |
parseAbsoluteFontSize(String fontSizeValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteFontSize(String) instead
|
static float |
parseAbsoluteFontSize(String fontSizeValue, String defaultMetric)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteFontSize(String, String) instead
|
static float |
parseAbsoluteLength(String length)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteLength(String) instead
|
static float |
parseAbsoluteLength(String length, String defaultMetric)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteLength(String, String) instead
|
static float |
parseAngle(String angle)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAngle(String) instead
|
static float |
parseAngle(String angle, String defaultMetric)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAngle(String, String) instead
|
static int[] |
parseAspectRatio(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAspectRatio(String) instead
|
static BlendMode |
parseBlendMode(String cssValue)
Parses the given css blend mode value.
|
static Double |
parseDouble(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseDouble(String) instead
|
static Float |
parseFloat(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseFloat(String) instead
|
static Integer |
parseInteger(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseInteger(String) instead
|
static UnitValue |
parseLengthValueToPt(String value, float emValue, float remValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseLengthValueToPt(String, float, float) instead
|
static float |
parseRelativeFontSize(String relativeFontSizeValue, float baseValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseRelativeFontSize(String, float) instead
|
static float |
parseRelativeValue(String relativeValue, float baseValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseRelativeValue(String, float) instead
|
static float |
parseResolution(String resolutionStr)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseResolution(String) instead
|
static float[] |
parseRgbaColor(String colorValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseRgbaColor(String) method instead
|
static UnitValue[] |
parseSpecificCornerBorderRadius(String specificBorderRadius, float emValue, float remValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseSpecificCornerBorderRadius(String, float, float) instead
|
static Range |
parseUnicodeRange(String unicodeRange)
Parses the unicode range.
|
static String |
removeDoubleSpacesAndTrim(String str)
Removes double spaces and trims a string.
|
static List<String> |
splitString(String value, char splitChar, EscapeGroup... escapeCharacters)
Splits the provided String by split character with respect of escape characters.
|
static List<String> |
splitStringWithComma(String value)
Splits the provided String by comma with respect of brackets.
|
public static List<String> splitStringWithComma(String value)
String
by comma with respect of brackets.
value
- to split
List
of split result
public static List<String> splitString(String value, char splitChar, EscapeGroup... escapeCharacters)
String
by split character with respect of escape characters.
value
- value to split
splitChar
- character to split the String
escapeCharacters
- escape characters
List
of split result
public static BlendMode parseBlendMode(String cssValue)
null
or an unknown blend mode, then the default css BlendMode.NORMAL
value would be returned.
cssValue
- the value to parse
BlendMode
instance representing the parsed value
public static List<List<String>> extractShorthandProperties(String str)
str
- the source string with shorthand properties
public static String normalizeCssProperty(String str)
str
- the property
public static String removeDoubleSpacesAndTrim(String str)
str
- the string
@Deprecated public static Integer parseInteger(String str)
CssDimensionParsingUtils.parseInteger(String)
instead
str
- a string that might be an integer value
@Deprecated public static Float parseFloat(String str)
CssDimensionParsingUtils.parseFloat(String)
instead
str
- a string that might be a float value
@Deprecated public static Double parseDouble(String str)
CssDimensionParsingUtils.parseDouble(String)
instead
str
- a string that might be a double value
@Deprecated public static float parseAngle(String angle, String defaultMetric)
CssDimensionParsingUtils.parseAngle(String, String)
instead
angle
- String containing the angle to parse
defaultMetric
- default metric to use in case the input string does not specify a metric
@Deprecated public static float parseAngle(String angle)
CssDimensionParsingUtils.parseAngle(String)
instead
angle
- String containing the angle to parse
@Deprecated public static int[] parseAspectRatio(String str)
CssDimensionParsingUtils.parseAspectRatio(String)
instead
str
- a string that might contain two integer values
@Deprecated public static float parseAbsoluteLength(String length, String defaultMetric)
CssDimensionParsingUtils.parseAbsoluteLength(String, String)
instead
length
- the string containing the length
defaultMetric
- the string containing the metric if it is possible that the length string does not contain one. If null the length is considered to be in px as is default in HTML/CSS
@Deprecated public static float parseAbsoluteLength(String length)
CssDimensionParsingUtils.parseAbsoluteLength(String)
instead
length
- the length as a string
@Deprecated public static float parseRelativeValue(String relativeValue, float baseValue)
CssDimensionParsingUtils.parseRelativeValue(String, float)
instead
relativeValue
- in %, em or ex
baseValue
- the value the returned float is based on
@Deprecated public static UnitValue parseLengthValueToPt(String value, float emValue, float remValue)
CssDimensionParsingUtils.parseLengthValueToPt(String, float, float)
instead
value
- the value
emValue
- the em value
remValue
- the root em value
@Deprecated public static boolean isValidNumericValue(String value)
CssTypesValidationUtils.isValidNumericValue(String)
instead
value
- the string that needs to be checked
@Deprecated public static float parseAbsoluteFontSize(String fontSizeValue, String defaultMetric)
CssDimensionParsingUtils.parseAbsoluteFontSize(String, String)
instead
A numeric value (without px, pt, etc in the given length string) is considered to be in the default metric that was given.
fontSizeValue
- the font size value as a String
defaultMetric
- the string containing the metric if it is possible that the length string does not contain one. If null the length is considered to be in px as is default in HTML/CSS.
float
@Deprecated public static float parseAbsoluteFontSize(String fontSizeValue)
CssDimensionParsingUtils.parseAbsoluteFontSize(String)
instead
A numeric value (without px, pt, etc in the given length string) is considered to be in the px.
fontSizeValue
- the font size value as a String
float
@Deprecated public static float parseRelativeFontSize(String relativeFontSizeValue, float baseValue)
CssDimensionParsingUtils.parseRelativeFontSize(String, float)
instead
relativeFontSizeValue
- the relative font size value as a String
baseValue
- the base value
float
@Deprecated public static UnitValue[] parseSpecificCornerBorderRadius(String specificBorderRadius, float emValue, float remValue)
CssDimensionParsingUtils.parseSpecificCornerBorderRadius(String, float, float)
instead
specificBorderRadius
- string that defines the border radius of specific corner.
emValue
- the em value
remValue
- the root em value
UnitValues
that define horizontal and vertical border radius values
@Deprecated public static float parseResolution(String resolutionStr)
CssDimensionParsingUtils.parseResolution(String)
instead
resolutionStr
- the resolution as a string
@Deprecated public static int determinePositionBetweenValueAndUnit(String string)
CssDimensionParsingUtils.determinePositionBetweenValueAndUnit(String)
instead
string
- containing a numeric value with a metric unit
@Deprecated public static boolean isMetricValue(String value)
CssTypesValidationUtils.isMetricValue(String)
instead
value
- the string that needs to be checked
@Deprecated public static boolean isAngleValue(String value)
CssTypesValidationUtils.isAngleValue(String)
instead
value
- the string that needs to be checked
@Deprecated public static boolean isRelativeValue(String value)
CssTypesValidationUtils.isRelativeValue(String)
instead
value
- the string that needs to be checked
@Deprecated public static boolean isFontRelativeValue(String value)
CssTypesValidationUtils.isRelativeValue(String)
method instead
value
- the string that needs to be checked
@Deprecated public static boolean isPercentageValue(String value)
CssTypesValidationUtils.isPercentageValue(String)
method instead
value
- the string that needs to be checked
@Deprecated public static boolean isRemValue(String value)
CssTypesValidationUtils.isRemValue(String)
method instead
value
- the string that needs to be checked
@Deprecated public static boolean isEmValue(String value)
CssTypesValidationUtils.isEmValue(String)
method instead
value
- the string that needs to be checked
@Deprecated public static boolean isExValue(String value)
CssTypesValidationUtils.isExValue(String)
method instead
value
- the string that needs to be checked
@Deprecated public static boolean isNumericValue(String value)
CssTypesValidationUtils.isNumericValue(String)
method instead
value
- the string that needs to be checked
@Deprecated public static boolean isNegativeValue(String value)
CssTypesValidationUtils.isNegativeValue(String)
method instead
value
- the string that needs to be checked
public static String extractUrl(String url)
url("file.jpg")
to file.jpg
.
url
- the url attribute to parse
public static String extractAttributeValue(String attrStr, IElementNode element)
attrStr
- the string contains attr() to extract attribute value
element
- the parentNode from which we extract information
@Deprecated public static boolean isBase64Data(String data)
CssTypesValidationUtils.isBase64Data(String)
method instead
data
- the data
public static int findNextUnescapedChar(String source, char ch, int startIndex)
source
- a source
ch
- the character to look for
startIndex
- where to start looking
@Deprecated public static boolean isColorProperty(String value)
CssTypesValidationUtils.isColorProperty(String)
method instead
value
- the value
public static boolean compareFloats(double d1, double d2)
d1
- first float to compare
d2
- second float to compare
public static boolean compareFloats(float f1, float f2)
f1
- first float to compare
f2
- second float to compare
@Deprecated public static float[] parseRgbaColor(String colorValue)
CssDimensionParsingUtils.parseRgbaColor(String)
method instead
colorValue
- the color value
public static Range parseUnicodeRange(String unicodeRange)
unicodeRange
- the string which stores the unicode range
Range
object
public static float convertPtsToPx(float pts)
pts
- float value to be converted to pixels
public static double convertPtsToPx(double pts)
pts
- double value to be converted to pixels
public static float convertPxToPts(float px)
px
- float value to be converted to pixels
public static double convertPxToPts(double px)
px
- double value to be converted to pixels
public static boolean isStyleSheetLink(IElementNode headChildElement)
IElementNode
represents a style sheet link.
headChildElement
- the head child element
@Deprecated public static boolean isInitialOrInheritOrUnset(String value)
CssTypesValidationUtils.isInitialOrInheritOrUnset(String)
method instead
value
- value to check
Copyright © 1998–2021 iText Group NV. All rights reserved.