< prev index next >
modules/graphics/src/main/java/com/sun/javafx/font/PrismFontLoader.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,32 ****
--- 23,33 ----
* questions.
*/
package com.sun.javafx.font;
+ import com.sun.javafx.text.FontHelper;
import javafx.scene.text.*;
import com.sun.javafx.tk.*;
import java.lang.reflect.Method;
import java.net.URL;
import java.io.InputStream;
*** 101,111 ****
return null;
}
@SuppressWarnings("deprecation")
private Font createFont(PGFont font) {
! return Font.impl_NativeFont(font,
font.getName(),
font.getFamilyName(),
font.getStyleName(),
font.getSize());
}
--- 102,112 ----
return null;
}
@SuppressWarnings("deprecation")
private Font createFont(PGFont font) {
! return FontHelper.nativeFont(font,
font.getName(),
font.getFamilyName(),
font.getStyleName(),
font.getSize());
}
*** 179,189 ****
weight.ordinal() >= FontWeight.BOLD.ordinal();
boolean italic = posture == FontPosture.ITALIC;
PGFont prismFont = fontFactory.createFont(family, bold, italic, size);
// Create Font and set implementation
! Font fxFont = Font.impl_NativeFont(prismFont, prismFont.getName(),
prismFont.getFamilyName(),
prismFont.getStyleName(), size);
return fxFont;
}
--- 180,190 ----
weight.ordinal() >= FontWeight.BOLD.ordinal();
boolean italic = posture == FontPosture.ITALIC;
PGFont prismFont = fontFactory.createFont(family, bold, italic, size);
// Create Font and set implementation
! Font fxFont = FontHelper.nativeFont(prismFont, prismFont.getName(),
prismFont.getFamilyName(),
prismFont.getStyleName(), size);
return fxFont;
}
*** 206,221 ****
// update the name variable to match what was actually loaded
String name = prismFont.getName();
String family = prismFont.getFamilyName();
String style = prismFont.getStyleName();
! font.impl_setNativeFont(prismFont, name, family, style);
}
@Override public FontMetrics getFontMetrics(Font font) {
if (font != null) {
! PGFont prismFont = (PGFont)font.impl_getNativeFont();
Metrics metrics = PrismFontUtils.getFontMetrics(prismFont);
// TODO: what's the difference between ascent and maxAscent?
float maxAscent = -metrics.getAscent();//metrics.getMaxAscent();
float ascent = -metrics.getAscent();
float xheight = metrics.getXHeight();
--- 207,222 ----
// update the name variable to match what was actually loaded
String name = prismFont.getName();
String family = prismFont.getFamilyName();
String style = prismFont.getStyleName();
! FontHelper.setNativeFont(font, prismFont, name, family, style);
}
@Override public FontMetrics getFontMetrics(Font font) {
if (font != null) {
! PGFont prismFont = (PGFont) FontHelper.getNativeFont(font);
Metrics metrics = PrismFontUtils.getFontMetrics(prismFont);
// TODO: what's the difference between ascent and maxAscent?
float maxAscent = -metrics.getAscent();//metrics.getMaxAscent();
float ascent = -metrics.getAscent();
float xheight = metrics.getXHeight();
*** 228,238 ****
return null; // this should never happen
}
}
@Override public float getCharWidth(char ch, Font font) {
! PGFont prismFont = (PGFont)font.impl_getNativeFont();
return (float)PrismFontUtils.getCharWidth(prismFont, ch);
}
@Override public float getSystemFontSize() {
// PrismFontFactory is what loads the DLL, so we may as
--- 229,239 ----
return null; // this should never happen
}
}
@Override public float getCharWidth(char ch, Font font) {
! PGFont prismFont = (PGFont) FontHelper.getNativeFont(font);
return (float)PrismFontUtils.getCharWidth(prismFont, ch);
}
@Override public float getSystemFontSize() {
// PrismFontFactory is what loads the DLL, so we may as
< prev index next >