com.openhtmltopdf.outputdevice.helper.FontResolverHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openhtmltopdf-core Show documentation
Show all versions of openhtmltopdf-core Show documentation
Open HTML to PDF is a CSS 2.1 renderer written in Java. This artifact contains the core rendering and layout code.
package com.openhtmltopdf.outputdevice.helper;
import com.openhtmltopdf.css.constants.IdentValue;
public class FontResolverHelper {
public static int convertWeightToInt(IdentValue weight) {
if (weight == IdentValue.NORMAL) {
return 400;
} else if (weight == IdentValue.BOLD) {
return 700;
} else if (weight == IdentValue.FONT_WEIGHT_100) {
return 100;
} else if (weight == IdentValue.FONT_WEIGHT_200) {
return 200;
} else if (weight == IdentValue.FONT_WEIGHT_300) {
return 300;
} else if (weight == IdentValue.FONT_WEIGHT_400) {
return 400;
} else if (weight == IdentValue.FONT_WEIGHT_500) {
return 500;
} else if (weight == IdentValue.FONT_WEIGHT_600) {
return 600;
} else if (weight == IdentValue.FONT_WEIGHT_700) {
return 700;
} else if (weight == IdentValue.FONT_WEIGHT_800) {
return 800;
} else if (weight == IdentValue.FONT_WEIGHT_900) {
return 900;
} else if (weight == IdentValue.LIGHTER) {
// FIXME
return 400;
} else if (weight == IdentValue.BOLDER) {
// FIXME
return 700;
}
throw new IllegalArgumentException();
}
}