src/share/classes/java/awt/Font.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 525      * added or subtracted.
 526      * This means, specifying a bold face and a bold style does not
 527      * double-embolden the font, and specifying a bold face and a plain
 528      * style does not lighten the font.
 529      * <p>
 530      * If no face for the requested style can be found, the font system
 531      * may apply algorithmic styling to achieve the desired style.
 532      * For example, if <code>ITALIC</code> is requested, but no italic
 533      * face is available, glyphs from the plain face may be algorithmically
 534      * obliqued (slanted).
 535      * <p>
 536      * Font name lookup is case insensitive, using the case folding
 537      * rules of the US locale.
 538      * <p>
 539      * If the <code>name</code> parameter represents something other than a
 540      * logical font, i.e. is interpreted as a physical font face or family, and
 541      * this cannot be mapped by the implementation to a physical font or a
 542      * compatible alternative, then the font system will map the Font
 543      * instance to "Dialog", such that for example, the family as reported
 544      * by {@link #getFamily() getFamily} will be "Dialog".
 545      * <p>
 546      *
 547      * @param name the font name.  This can be a font face name or a font
 548      * family name, and may represent either a logical font or a physical
 549      * font found in this {@code GraphicsEnvironment}.
 550      * The family names for logical fonts are: Dialog, DialogInput,
 551      * Monospaced, Serif, or SansSerif. Pre-defined String constants exist
 552      * for all of these names, for example, {@code DIALOG}. If {@code name} is
 553      * {@code null}, the <em>logical font name</em> of the new
 554      * {@code Font} as returned by {@code getName()} is set to
 555      * the name "Default".
 556      * @param style the style constant for the {@code Font}
 557      * The style argument is an integer bitmask that may
 558      * be {@code PLAIN}, or a bitwise union of {@code BOLD} and/or
 559      * {@code ITALIC} (for example, {@code ITALIC} or {@code BOLD|ITALIC}).
 560      * If the style argument does not conform to one of the expected
 561      * integer bitmasks then the style is set to {@code PLAIN}.
 562      * @param size the point size of the {@code Font}
 563      * @see GraphicsEnvironment#getAllFonts
 564      * @see GraphicsEnvironment#getAvailableFontFamilyNames
 565      * @since JDK1.0


   1 /*
   2  * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 525      * added or subtracted.
 526      * This means, specifying a bold face and a bold style does not
 527      * double-embolden the font, and specifying a bold face and a plain
 528      * style does not lighten the font.
 529      * <p>
 530      * If no face for the requested style can be found, the font system
 531      * may apply algorithmic styling to achieve the desired style.
 532      * For example, if <code>ITALIC</code> is requested, but no italic
 533      * face is available, glyphs from the plain face may be algorithmically
 534      * obliqued (slanted).
 535      * <p>
 536      * Font name lookup is case insensitive, using the case folding
 537      * rules of the US locale.
 538      * <p>
 539      * If the <code>name</code> parameter represents something other than a
 540      * logical font, i.e. is interpreted as a physical font face or family, and
 541      * this cannot be mapped by the implementation to a physical font or a
 542      * compatible alternative, then the font system will map the Font
 543      * instance to "Dialog", such that for example, the family as reported
 544      * by {@link #getFamily() getFamily} will be "Dialog".

 545      *
 546      * @param name the font name.  This can be a font face name or a font
 547      * family name, and may represent either a logical font or a physical
 548      * font found in this {@code GraphicsEnvironment}.
 549      * The family names for logical fonts are: Dialog, DialogInput,
 550      * Monospaced, Serif, or SansSerif. Pre-defined String constants exist
 551      * for all of these names, for example, {@code DIALOG}. If {@code name} is
 552      * {@code null}, the <em>logical font name</em> of the new
 553      * {@code Font} as returned by {@code getName()} is set to
 554      * the name "Default".
 555      * @param style the style constant for the {@code Font}
 556      * The style argument is an integer bitmask that may
 557      * be {@code PLAIN}, or a bitwise union of {@code BOLD} and/or
 558      * {@code ITALIC} (for example, {@code ITALIC} or {@code BOLD|ITALIC}).
 559      * If the style argument does not conform to one of the expected
 560      * integer bitmasks then the style is set to {@code PLAIN}.
 561      * @param size the point size of the {@code Font}
 562      * @see GraphicsEnvironment#getAllFonts
 563      * @see GraphicsEnvironment#getAvailableFontFamilyNames
 564      * @since JDK1.0