当前位置: 首页>>代码示例>>Java>>正文


Java Font.ITALIC属性代码示例

本文整理汇总了Java中java.awt.Font.ITALIC属性的典型用法代码示例。如果您正苦于以下问题:Java Font.ITALIC属性的具体用法?Java Font.ITALIC怎么用?Java Font.ITALIC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.Font的用法示例。


在下文中一共展示了Font.ITALIC属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGlyphImageFromWindows

long getGlyphImageFromWindows(int glyphCode) {
    String family = fileFont.getFamilyName(null);
    int style = desc.style & Font.BOLD | desc.style & Font.ITALIC
        | fileFont.getStyle();
    int size = intPtSize;
    long ptr = _getGlyphImageFromWindows
        (family, style, size, glyphCode,
         desc.fmHint == INTVAL_FRACTIONALMETRICS_ON);
    if (ptr != 0) {
        /* Get the advance from the JDK rasterizer. This is mostly
         * necessary for the fractional metrics case, but there are
         * also some very small number (<0.25%) of marginal cases where
         * there is some rounding difference between windows and JDK.
         * After these are resolved, we can restrict this extra
         * work to the FM case.
         */
        float advance = getGlyphAdvance(glyphCode, false);
        StrikeCache.unsafe.putFloat(ptr + StrikeCache.xAdvanceOffset,
                                    advance);
        return ptr;
    } else {
        return fileFont.getGlyphImage(pScalerContext, glyphCode);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:FileFontStrike.java

示例2: getFontWithExactStyleMatch

public Font2D getFontWithExactStyleMatch(int style) {

        switch (style) {

        case Font.PLAIN:
            return plain;

        case Font.BOLD:
            return bold;

        case Font.ITALIC:
            return italic;

        case Font.BOLD|Font.ITALIC:
            return bolditalic;

        default:
            return null;
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:FontFamily.java

示例3: setStyle

/**
 * Changes the style (Bold, Italic ) of the selected text by checking the
 * style buttons
 */
public static void setStyle() {

    int style = Font.PLAIN;

    if (ckbbold.isSelected()) {
        style |= Font.BOLD;
    }

    if (ckbitalic.isSelected()) {
        style |= Font.ITALIC;
    }

    fOwner.tTree.setFont(fOwner.txtCommand.getFont().deriveFont(style));
    fOwner.txtCommand.setFont(
        fOwner.txtCommand.getFont().deriveFont(style));
    fOwner.txtResult.setFont(
        fOwner.txtResult.getFont().deriveFont(style));
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:22,代码来源:FontDialogSwing.java

示例4: setStyle

protected void setStyle() {

        String fName = fullName.toLowerCase();

        for (int i=0; i < boldItalicNames.length; i++) {
            if (fName.indexOf(boldItalicNames[i]) != -1) {
                style = Font.BOLD|Font.ITALIC;
                return;
            }
        }

        for (int i=0; i < italicNames.length; i++) {
            if (fName.indexOf(italicNames[i]) != -1) {
                style = Font.ITALIC;
                return;
            }
        }

        for (int i=0; i < boldNames.length; i++) {
            if (fName.indexOf(boldNames[i]) != -1 ) {
                style = Font.BOLD;
                return;
            }
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:Font2D.java

示例5: getListCellRendererComponent

public Component getListCellRendererComponent(JList list, Object value, int index,
    boolean isSelected, boolean cellHasFocus) {

  super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

  if (standardFont == null) {
    standardFont = getFont();
    highlightFont = new Font(standardFont.getFamily(), Font.BOLD + Font.ITALIC, standardFont
        .getSize());
  }

  if (value instanceof AddressBookEntry) {
    final AddressBookEntry e = (AddressBookEntry) value;
    setIcon(e.getIcon(LEAF_ICON_SIZE));
    if (e.isCurrent()) {
      setFont(highlightFont);
      setText(e.toString() + Resources.getString("ServerAddressBook.current")); //$NON-NLS-1$
    }
    else {
      setFont(standardFont);
    }

  }
  return this;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:25,代码来源:ServerAddressBook.java

示例6: updateFont

/**
 * 
 */
protected void updateFont()
{
	int size = (int) Math.round(state.fontSize * state.scale);
	int style = ((state.fontStyle
			& mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD) ? Font.BOLD
					: Font.PLAIN;
	style += ((state.fontStyle
			& mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC)
					? Font.ITALIC : Font.PLAIN;

	if (lastFont == null || !lastFontFamily.equals(state.fontFamily)
			|| size != lastFontSize || style != lastFontStyle)
	{
		lastFont = createFont(state.fontFamily, style, size);
		lastFontFamily = state.fontFamily;
		lastFontStyle = style;
		lastFontSize = size;
	}

	state.g.setFont(lastFont);
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:24,代码来源:mxGraphicsCanvas2D.java

示例7: decodeFontStyle

public static String decodeFontStyle(int style) {
    switch(style) {
        case Font.BOLD:
            return Editor.fromConfiguracao.getValor("Inspector.obj.font.bold");
        case Font.PLAIN:
            return Editor.fromConfiguracao.getValor("Inspector.obj.font.plain");
        case Font.ITALIC:
            return Editor.fromConfiguracao.getValor("Inspector.obj.font.italic");
        case Font.BOLD | Font.ITALIC:
            return Editor.fromConfiguracao.getValor("Inspector.obj.font.bolditalic");
    }
    return "";
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:13,代码来源:Utilidades.java

示例8: getStyled

/**
 * Get a styled version of a particular font family
 * 
 * @param familyName The name of the font family
 * @param style The style (@see java.awt.Font#PLAIN)
 * @return The styled font or null if no such font exists
 */
public static FontData getStyled(String familyName, int style) {
	boolean b = (style & Font.BOLD) != 0;
	boolean i = (style & Font.ITALIC) != 0;

	if (b & i) {
		return getBoldItalic(familyName);
	} else if (b) {
		return getBold(familyName);
	} else if (i) {
		return getItalic(familyName);
	} else {
		return getPlain(familyName);
	}
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:21,代码来源:FontData.java

示例9: toStyleDisplayString

public static String toStyleDisplayString(int style) {
	switch (style) {
	case Font.PLAIN:
		return Strings.get("fontPlainStyle");
	case Font.ITALIC:
		return Strings.get("fontItalicStyle");
	case Font.BOLD:
		return Strings.get("fontBoldStyle");
	case Font.BOLD | Font.ITALIC:
		return Strings.get("fontBoldItalicStyle");
	default:
		return "??";
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:14,代码来源:FontUtil.java

示例10: getStyleIndex

protected static int getStyleIndex(int style) {
    switch (style) {
        case Font.PLAIN:
            return 0;
        case Font.BOLD:
            return 1;
        case Font.ITALIC:
            return 2;
        case Font.BOLD | Font.ITALIC:
            return 3;
        default:
            return 0;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:FontConfiguration.java

示例11: doTest

protected void doTest() {
    Font f = new Font(Font.SANS_SERIF, Font.ITALIC, 24);
    f.getNumGlyphs();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ClassLoaderLeakTest.java

示例12: getFont

public Font2D getFont(int style) {

        switch (style) {

        case Font.PLAIN:
            return plain;

        case Font.BOLD:
            if (bold != null) {
                return bold;
            } else if (plain != null && plain.canDoStyle(style)) {
                    return plain;
            } else {
                return null;
            }

        case Font.ITALIC:
            if (italic != null) {
                return italic;
            } else if (plain != null && plain.canDoStyle(style)) {
                    return plain;
            } else {
                return null;
            }

        case Font.BOLD|Font.ITALIC:
            if (bolditalic != null) {
                return bolditalic;
            } else if (bold != null && bold.canDoStyle(style)) {
                return bold;
            } else if (italic != null && italic.canDoStyle(style)) {
                    return italic;
            } else if (plain != null && plain.canDoStyle(style)) {
                    return plain;
            } else {
                return null;
            }
        default:
            return null;
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:FontFamily.java

示例13: setStyle

private void setStyle(ByteBuffer os_2Table) {
        if (os_2Table == null) {
            return;
        }
        if (os_2Table.capacity() >= 8) {
            fontWeight = os_2Table.getChar(4) & 0xffff;
            fontWidth  = os_2Table.getChar(6) & 0xffff;
        }
        /* fsSelection is unsigned short at buffer offset 62 */
        if (os_2Table.capacity() < 64) {
            super.setStyle();
            return;
        }
        int fsSelection = os_2Table.getChar(62) & 0xffff;
        int italic  = fsSelection & fsSelectionItalicBit;
        int bold    = fsSelection & fsSelectionBoldBit;
        int regular = fsSelection & fsSelectionRegularBit;
//      System.out.println("platname="+platName+" font="+fullName+
//                         " family="+familyName+
//                         " R="+regular+" I="+italic+" B="+bold);
        if (regular!=0 && ((italic|bold)!=0)) {
            /* This is inconsistent. Try using the font name algorithm */
            super.setStyle();
            return;
        } else if ((regular|italic|bold) == 0) {
            /* No style specified. Try using the font name algorithm */
            super.setStyle();
            return;
        }
        switch (bold|italic) {
        case fsSelectionItalicBit:
            style = Font.ITALIC;
            break;
        case fsSelectionBoldBit:
            if (FontUtilities.isSolaris && platName.endsWith("HG-GothicB.ttf")) {
                /* Workaround for Solaris's use of a JA font that's marked as
                 * being designed bold, but is used as a PLAIN font.
                 */
                style = Font.PLAIN;
            } else {
                style = Font.BOLD;
            }
            break;
        case fsSelectionBoldBit|fsSelectionItalicBit:
            style = Font.BOLD|Font.ITALIC;
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:47,代码来源:TrueTypeFont.java

示例14: RadioButtonFrame

public RadioButtonFrame()
{
   super("RadioButton Test");
   setLayout(new FlowLayout()); 

   textField = new JTextField("Watch the font style change", 25);
   add(textField); // add textField to JFrame

   // create radio buttons
   plainJRadioButton = new JRadioButton("Plain", true);
   boldJRadioButton = new JRadioButton("Bold", false);
   italicJRadioButton = new JRadioButton("Italic", false);
   boldItalicJRadioButton = new JRadioButton("Bold/Italic", false);
   add(plainJRadioButton); // add plain button to JFrame
   add(boldJRadioButton); // add bold button to JFrame
   add(italicJRadioButton); // add italic button to JFrame
   add(boldItalicJRadioButton); // add bold and italic button

   // create logical relationship between JRadioButtons
   radioGroup = new ButtonGroup(); // create ButtonGroup
   radioGroup.add(plainJRadioButton); // add plain to group
   radioGroup.add(boldJRadioButton); // add bold to group
   radioGroup.add(italicJRadioButton); // add italic to group
   radioGroup.add(boldItalicJRadioButton); // add bold and italic

   // create font objects
   plainFont = new Font("Serif", Font.PLAIN, 14);
   boldFont = new Font("Serif", Font.BOLD, 14);
   italicFont = new Font("Serif", Font.ITALIC, 14);
   boldItalicFont = new Font("Serif", Font.BOLD + Font.ITALIC, 14);
   textField.setFont(plainFont);

   // register events for JRadioButtons
   plainJRadioButton.addItemListener(
      new RadioButtonHandler(plainFont));
   boldJRadioButton.addItemListener(
      new RadioButtonHandler(boldFont));
   italicJRadioButton.addItemListener(
      new RadioButtonHandler(italicFont));
   boldItalicJRadioButton.addItemListener(
      new RadioButtonHandler(boldItalicFont));
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:42,代码来源:RadioButtonFrame.java

示例15: instantiate

protected Expression instantiate(Object oldInstance, Encoder out) {
    Font font = (Font) oldInstance;

    int count = 0;
    String family = null;
    int style = Font.PLAIN;
    int size = 12;

    Map<TextAttribute, ?> basic = font.getAttributes();
    Map<TextAttribute, Object> clone = new HashMap<>(basic.size());
    for (TextAttribute key : basic.keySet()) {
        Object value = basic.get(key);
        if (value != null) {
            clone.put(key, value);
        }
        if (key == TextAttribute.FAMILY) {
            if (value instanceof String) {
                count++;
                family = (String) value;
            }
        }
        else if (key == TextAttribute.WEIGHT) {
            if (TextAttribute.WEIGHT_REGULAR.equals(value)) {
                count++;
            } else if (TextAttribute.WEIGHT_BOLD.equals(value)) {
                count++;
                style |= Font.BOLD;
            }
        }
        else if (key == TextAttribute.POSTURE) {
            if (TextAttribute.POSTURE_REGULAR.equals(value)) {
                count++;
            } else if (TextAttribute.POSTURE_OBLIQUE.equals(value)) {
                count++;
                style |= Font.ITALIC;
            }
        } else if (key == TextAttribute.SIZE) {
            if (value instanceof Number) {
                Number number = (Number) value;
                size = number.intValue();
                if (size == number.floatValue()) {
                    count++;
                }
            }
        }
    }
    Class<?> type = font.getClass();
    if (count == clone.size()) {
        return new Expression(font, type, "new", new Object[]{family, style, size});
    }
    if (type == Font.class) {
        return new Expression(font, type, "getFont", new Object[]{clone});
    }
    return new Expression(font, type, "new", new Object[]{Font.getFont(clone)});
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:55,代码来源:MetaData.java


注:本文中的java.awt.Font.ITALIC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。