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 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 |
isStyleSheetLink(IElementNode headChildElement)
Checks if an IElementNode represents a style sheet link.
|
static String |
normalizeCssProperty(String str)
Normalizes a CSS property.
|
static BlendMode |
parseBlendMode(String cssValue)
Parses the given css blend mode value.
|
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
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
public static int findNextUnescapedChar(String source, char ch, int startIndex)
source - a source
ch - the character to look for
startIndex - where to start looking
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
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
Copyright © 1998–2022 iText Group NV. All rights reserved.