Java 类java.awt.peer.FontPeer 实例源码

项目:cn1    文件:LinuxFontManager.java   
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    LinuxFont peer;
    int familyIndex = getFamilyIndex(name);
    if (familyIndex != -1){
        // !! we use family names from the list with cached families because 
        // they are differ from the family names in xlfd structure, in xlfd 
        // family names mostly in lower case.
        peer = new LinuxFont(getFamily(familyIndex), style, size);
        peer.setFamily(getFamily(familyIndex));
        return peer;
    }
    int faceIndex = getFaceIndex(name); 
    if (faceIndex != -1){
        style |= LinuxNativeFont.getFontStyle(faceIndex);
        name = LinuxNativeFont.getFamilyFromFaceIndex(faceIndex);

        peer = new LinuxFont(name, style, size);
        return peer;
    }

    return null;
}
项目:cn1    文件:WinFontManager.java   
@Override
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    WindowsFont peer;
    if (isFamilyExist(name)){
        peer = new WindowsFont(name, style, size);
        peer.setFamily(name);
        return peer;
    }
    int faceIndex = getFaceIndex(name); 
    if (faceIndex != -1){
        style |= NativeFont.fontStyles[faceIndex];
        name = NativeFont.getFamily(faceIndex);

        peer = new WindowsFont(name, style, size);
        return peer;
    }

    return null;
}
项目:cn1    文件:FontManager.java   
/**
 * Returns default font peer class with "Default" name that is usually 
 * used when font with specified font names and style doesn't exsist 
 * on a system. 
 * 
 * @param style style of the font
 * @param size size of the font
 */
public FontPeer getDefaultFont(int style, int size){
    updateFontsTable();

    FontPeer peer = null;
    String key = DEFAULT_NAME.concat(String.valueOf(style)).
                concat(String.valueOf(size));

    HashMapReference hmr   = fontsTable.get(key);
    if (hmr != null) {
        peer = hmr.get();
    }

    if (peer == null) {
        peer = createDefaultFont(style, size);

        ((FontPeerImpl)peer).setFamily(DEFAULT_NAME);
        ((FontPeerImpl)peer).setPSName(DEFAULT_NAME);
        ((FontPeerImpl)peer).setFontName(DEFAULT_NAME);

        fontsTable.put(key, new HashMapReference(key, peer, queue));
    }

    return peer;
}
项目:cn1    文件:FLFontManager.java   
@Override
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    FontPeerImpl peer = null;        

    if (isFontExistInList(name, style)){         
        try {
            peer = new FLFontPeer(name, style, size);

            peer.setFamily(name);
        } catch(NullPointerException e) {
            peer = new FLFontPeer(DEFAULT_NAME, style, size);

            peer.setFamily(DEFAULT_NAME);
        }
    } else {
        peer = new FLFontPeer(DEFAULT_NAME, style, size);

        peer.setFamily(DEFAULT_NAME);
    }

    return peer;
}
项目:cn1    文件:FLFontManager.java   
/**
 * Returns default font peer class with "Default" name that is usually 
 * used when font with specified font names and style doesn't exsist 
 * on a system. 
 * 
 * @param style style of the font
 * @param size size of the font
 */
@Override
public FontPeer getDefaultFont(int style, int size){

    FontPeer peer = null;
    String key = DEFAULT_NAME.concat(String.valueOf(style)).
                concat(String.valueOf(size));

    HashMapReference hmr   = fontsTable.get(key);
    if (hmr != null) {
        peer = hmr.get();
    }

    if (peer == null) {
        peer = createDefaultFont(style, size);

        ((FontPeerImpl)peer).setFamily(DEFAULT_NAME);
        ((FontPeerImpl)peer).setPSName(DEFAULT_NAME);
        ((FontPeerImpl)peer).setFontName(DEFAULT_NAME);

        fontsTable.put(key, new HashMapReference(key, peer, queue));
    }

    return peer;
}
项目:freeVM    文件:LinuxFontManager.java   
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    LinuxFont peer;
    int familyIndex = getFamilyIndex(name);
    if (familyIndex != -1){
        // !! we use family names from the list with cached families because 
        // they are differ from the family names in xlfd structure, in xlfd 
        // family names mostly in lower case.
        peer = new LinuxFont(getFamily(familyIndex), style, size);
        peer.setFamily(getFamily(familyIndex));
        return peer;
    }
    int faceIndex = getFaceIndex(name); 
    if (faceIndex != -1){
        style |= LinuxNativeFont.getFontStyle(faceIndex);
        name = LinuxNativeFont.getFamilyFromFaceIndex(faceIndex);

        peer = new LinuxFont(name, style, size);
        return peer;
    }

    return null;
}
项目:freeVM    文件:WinFontManager.java   
@Override
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    WindowsFont peer;
    if (isFamilyExist(name)){
        peer = new WindowsFont(name, style, size);
        peer.setFamily(name);
        return peer;
    }
    int faceIndex = getFaceIndex(name); 
    if (faceIndex != -1){
        style |= NativeFont.fontStyles[faceIndex];
        name = NativeFont.getFamily(faceIndex);

        peer = new WindowsFont(name, style, size);
        return peer;
    }

    return null;
}
项目:freeVM    文件:FontManager.java   
/**
 * Returns default font peer class with "Default" name that is usually 
 * used when font with specified font names and style doesn't exsist 
 * on a system. 
 * 
 * @param style style of the font
 * @param size size of the font
 */
public FontPeer getDefaultFont(int style, int size){
    updateFontsTable();

    FontPeer peer = null;
    String key = DEFAULT_NAME.concat(String.valueOf(style)).
                concat(String.valueOf(size));

    HashMapReference hmr   = fontsTable.get(key);
    if (hmr != null) {
        peer = hmr.get();
    }

    if (peer == null) {
        peer = createDefaultFont(style, size);

        ((FontPeerImpl)peer).setFamily(DEFAULT_NAME);
        ((FontPeerImpl)peer).setPSName(DEFAULT_NAME);
        ((FontPeerImpl)peer).setFontName(DEFAULT_NAME);

        fontsTable.put(key, new HashMapReference(key, peer, queue));
    }

    return peer;
}
项目:freeVM    文件:LinuxFontManager.java   
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    LinuxFont peer;
    int familyIndex = getFamilyIndex(name);
    if (familyIndex != -1){
        // !! we use family names from the list with cached families because 
        // they are differ from the family names in xlfd structure, in xlfd 
        // family names mostly in lower case.
        peer = new LinuxFont(getFamily(familyIndex), style, size);
        peer.setFamily(getFamily(familyIndex));
        return peer;
    }
    int faceIndex = getFaceIndex(name); 
    if (faceIndex != -1){
        style |= LinuxNativeFont.getFontStyle(faceIndex);
        name = LinuxNativeFont.getFamilyFromFaceIndex(faceIndex);

        peer = new LinuxFont(name, style, size);
        return peer;
    }

    return null;
}
项目:freeVM    文件:WinFontManager.java   
@Override
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    WindowsFont peer;
    if (isFamilyExist(name)){
        peer = new WindowsFont(name, style, size);
        peer.setFamily(name);
        return peer;
    }
    int faceIndex = getFaceIndex(name); 
    if (faceIndex != -1){
        style |= NativeFont.fontStyles[faceIndex];
        name = NativeFont.getFamily(faceIndex);

        peer = new WindowsFont(name, style, size);
        return peer;
    }

    return null;
}
项目:freeVM    文件:FontManager.java   
/**
 * Returns default font peer class with "Default" name that is usually 
 * used when font with specified font names and style doesn't exsist 
 * on a system. 
 * 
 * @param style style of the font
 * @param size size of the font
 */
public FontPeer getDefaultFont(int style, int size){
    updateFontsTable();

    FontPeer peer = null;
    String key = DEFAULT_NAME.concat(String.valueOf(style)).
                concat(String.valueOf(size));

    HashMapReference hmr   = fontsTable.get(key);
    if (hmr != null) {
        peer = hmr.get();
    }

    if (peer == null) {
        peer = createDefaultFont(style, size);

        ((FontPeerImpl)peer).setFamily(DEFAULT_NAME);
        ((FontPeerImpl)peer).setPSName(DEFAULT_NAME);
        ((FontPeerImpl)peer).setFontName(DEFAULT_NAME);

        fontsTable.put(key, new HashMapReference(key, peer, queue));
    }

    return peer;
}
项目:freeVM    文件:FLFontManager.java   
@Override
public FontPeer createPhysicalFontPeer(String name, int style, int size) {
    FontPeerImpl peer = null;        

    if (isFontExistInList(name, style)){         
        try {
            peer = new FLFontPeer(name, style, size);

            peer.setFamily(name);
        } catch(NullPointerException e) {
            peer = new FLFontPeer(DEFAULT_NAME, style, size);

            peer.setFamily(DEFAULT_NAME);
        }
    } else {
        peer = new FLFontPeer(DEFAULT_NAME, style, size);

        peer.setFamily(DEFAULT_NAME);
    }

    return peer;
}
项目:freeVM    文件:FLFontManager.java   
/**
 * Returns default font peer class with "Default" name that is usually 
 * used when font with specified font names and style doesn't exsist 
 * on a system. 
 * 
 * @param style style of the font
 * @param size size of the font
 */
@Override
public FontPeer getDefaultFont(int style, int size){

    FontPeer peer = null;
    String key = DEFAULT_NAME.concat(String.valueOf(style)).
                concat(String.valueOf(size));

    HashMapReference hmr   = fontsTable.get(key);
    if (hmr != null) {
        peer = hmr.get();
    }

    if (peer == null) {
        peer = createDefaultFont(style, size);

        ((FontPeerImpl)peer).setFamily(DEFAULT_NAME);
        ((FontPeerImpl)peer).setPSName(DEFAULT_NAME);
        ((FontPeerImpl)peer).setFontName(DEFAULT_NAME);

        fontsTable.put(key, new HashMapReference(key, peer, queue));
    }

    return peer;
}
项目:OpenJSharp    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:OpenJSharp    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:jdk8u-jdk    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:openjdk-jdk10    文件:Font.java   
/**
 * Gets the peer of this {@code Font}.
 *
 * @return the peer of the {@code Font}.
 */
private FontPeer getFontPeer() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        if (tk instanceof ComponentFactory) {
            peer = ((ComponentFactory) tk).getFontPeer(name, style);
        }
    }
    return peer;
}
项目:openjdk-jdk10    文件:HeadlessToolkit.java   
@Override
public FontPeer getFontPeer(String name, int style) {
    if (componentFactory != null) {
        return componentFactory.getFontPeer(name, style);
    }
    return null;
}
项目:openjdk9    文件:Font.java   
/**
 * Gets the peer of this {@code Font}.
 *
 * @return the peer of the {@code Font}.
 */
private FontPeer getFontPeer() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        if (tk instanceof ComponentFactory) {
            peer = ((ComponentFactory) tk).getFontPeer(name, style);
        }
    }
    return peer;
}
项目:openjdk9    文件:HeadlessToolkit.java   
@Override
public FontPeer getFontPeer(String name, int style) {
    if (componentFactory != null) {
        return componentFactory.getFontPeer(name, style);
    }
    return null;
}
项目:Java8CN    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:jdk8u_jdk    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:lookaside_java-1.8.0-openjdk    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:javify    文件:XGraphics2D.java   
public void setFont(Font f)
{
  super.setFont(f);
  FontPeer p = getFont().getPeer();
  if (p instanceof XFontPeer)
    {
      XFontPeer xFontPeer = (XFontPeer) p;
      xgc.set_font(xFontPeer.getXFont());
    }
}
项目:javify    文件:XGraphics2D.java   
public void drawString(String s, int x, int y)
{
  FontPeer p = getFont().getPeer();
  if (p instanceof XFontPeer)
    {
      int tx = (int) transform.getTranslateX();
      int ty = (int) transform.getTranslateY();
      xdrawable.text(xgc, x + tx, y + ty, s);
    }
  else
    {
      super.drawString(s, x, y);
    }
}
项目:javify    文件:GtkToolkit.java   
/**
 * Private method that allows size to be set at initialization time.
 */
private FontPeer getFontPeer (String name, int style, int size)
{
  Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>();
  ClasspathFontPeer.copyStyleToAttrs (style, attrs);
  ClasspathFontPeer.copySizeToAttrs (size, attrs);
  return getClasspathFontPeer (name, attrs);
}
项目:javify    文件:QtToolkit.java   
protected FontPeer getFontPeer(String name,
                               int style)
{
  Map attrs = new HashMap ();
  ClasspathFontPeer.copyStyleToAttrs(style, attrs);
  ClasspathFontPeer.copySizeToAttrs(12, attrs); // Default size is 12.
  return getClasspathFontPeer (name, attrs);
}
项目:jvm-stm    文件:XGraphics2D.java   
public void setFont(Font f)
{
  super.setFont(f);
  FontPeer p = getFont().getPeer();
  if (p instanceof XFontPeer)
    {
      XFontPeer xFontPeer = (XFontPeer) p;
      xgc.set_font(xFontPeer.getXFont());
    }
}
项目:jvm-stm    文件:XGraphics2D.java   
public void drawString(String s, int x, int y)
{
  FontPeer p = getFont().getPeer();
  if (p instanceof XFontPeer)
    {
      int tx = (int) transform.getTranslateX();
      int ty = (int) transform.getTranslateY();
      xdrawable.text(xgc, x + tx, y + ty, s);
    }
  else
    {
      super.drawString(s, x, y);
    }
}
项目:jvm-stm    文件:GtkToolkit.java   
/**
 * Private method that allows size to be set at initialization time.
 */
private FontPeer getFontPeer (String name, int style, int size) 
{
  Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>();
  ClasspathFontPeer.copyStyleToAttrs (style, attrs);
  ClasspathFontPeer.copySizeToAttrs (size, attrs);
  return getClasspathFontPeer (name, attrs);
}
项目:jvm-stm    文件:QtToolkit.java   
protected FontPeer getFontPeer(String name,
         int style)
{
  Map attrs = new HashMap ();
  ClasspathFontPeer.copyStyleToAttrs(style, attrs);
  ClasspathFontPeer.copySizeToAttrs(12, attrs); // Default size is 12.
  return getClasspathFontPeer (name, attrs);
}
项目:VarJ    文件:Font.java   
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:jdk-1.7-annotated    文件:Font.java   
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:infobip-open-jdk-8    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:jdk8u-dev-jdk    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:jdk7-jdk    文件:Font.java   
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:openjdk-source-code-learn    文件:Font.java   
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:OLD-OpenJDK8    文件:Font.java   
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        this.peer = tk.getFontPeer(name, style);
    }
    return peer;
}
项目:cn1    文件:FontManager.java   
/**
 * Returns platform-dependent Font peer created from the specified 
 * Font object from the table with cached FontPeers instances.
 * 
 * Note, this method checks whether FontPeer with specified parameters 
 * exists in the table with cached FontPeers' instances. If there is no needed 
 * instance - it is created and cached.
 * 
 * @param fontName name of the font 
 * @param _fontStyle style of the font 
 * @param size font size
 * 
 * @return platform dependent FontPeer implementation created from 
 * the specified parameters
 */
public FontPeer getFontPeer(String fontName, int _fontStyle, int size) {

    updateFontsTable();

    FontPeer peer = null;
    String key; 
    String name;
    int fontStyle = _fontStyle;

    int logicalIndex = getLogicalFaceIndex(fontName);

    if (logicalIndex != -1){
        name = getLogicalFaceFromFont(fontStyle, logicalIndex);
        fontStyle = getStyleFromLogicalFace(name);
        key = name.concat(String.valueOf(size));
    } else {
        name = fontName;
        key = name.concat(String.valueOf(fontStyle)).
                concat(String.valueOf(size));
    }

    HashMapReference hmr   = fontsTable.get(key);
    if (hmr != null) {
        peer = hmr.get();
    }

    if (peer == null) {
        peer = createFontPeer(name, fontStyle, size, logicalIndex);
        if (peer == null){
            peer = getFontPeer(DIALOG_NAME, fontStyle, size);
        }
        fontsTable.put(key, new HashMapReference(key, peer, queue));
    }

    return peer;
}
项目:cn1    文件:FontManager.java   
/**
 * Returns instance of font peer (logical or physical) according to the 
 * specified parameters.
 * 
 * @param name font face name
 * @param style style of the font
 * @param size size of the font
 * @param logicalIndex index of the logical face name in LOGICAL_FONT_FACES 
 * array or -1 if desired font peer is not logical.
 */
protected FontPeer createFontPeer(String name, int style, int size, int logicalIndex){
    FontPeer peer;
    if (logicalIndex != -1){
        peer = createLogicalFontPeer(name, style, size);
    }else {
        peer = createPhysicalFontPeer(name, style, size);
    }

    return peer;
}