com.sun.javafx.webkit.prism.WCFontCustomPlatformDataImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openjfx-78-backport Show documentation
Show all versions of openjfx-78-backport Show documentation
This is a backport of OpenJFX 8 to run on Java 7.
The newest version!
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
*/
package com.sun.javafx.webkit.prism;
import com.sun.javafx.font.FontFactory;
import com.sun.javafx.font.PGFont;
import com.sun.prism.GraphicsPipeline;
import com.sun.webkit.graphics.WCFont;
import com.sun.webkit.graphics.WCFontCustomPlatformData;
import java.io.IOException;
import java.io.InputStream;
final class WCFontCustomPlatformDataImpl extends WCFontCustomPlatformData {
private final PGFont font;
WCFontCustomPlatformDataImpl(InputStream inputStream) throws IOException {
FontFactory factory = GraphicsPipeline.getPipeline().getFontFactory();
font = factory.loadEmbeddedFont(null, inputStream, 10, false);
if (font == null) {
throw new IOException("Error loading font");
}
}
@Override
protected WCFont createFont(int size, boolean bold, boolean italic) {
FontFactory factory = GraphicsPipeline.getPipeline().getFontFactory();
return new WCFontImpl(factory.deriveFont(font, bold, italic, size));
}
}