< prev index next >

src/java.desktop/share/classes/sun/font/Type1Font.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 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


  97              });
  98         }
  99     }
 100 
 101     WeakReference<Object> bufferRef = new WeakReference<>(null);
 102 
 103     private String psName = null;
 104 
 105     private static HashMap<String, String> styleAbbreviationsMapping;
 106     private static HashSet<String> styleNameTokes;
 107 
 108     static {
 109         styleAbbreviationsMapping = new HashMap<>();
 110         styleNameTokes = new HashSet<>();
 111 
 112         /* These abbreviation rules are taken from Appendix 1 of Adobe Technical Note #5088 */
 113         /* NB: this list is not complete - we did not include abbreviations which contain
 114                several capital letters because current expansion algorithm do not support this.
 115                (namely we have omited MM aka "Multiple Master", OsF aka "Oldstyle figures",
 116                            OS aka "Oldstyle", SC aka "Small caps" and  DS aka "Display" */
 117         String nm[] = {"Black", "Bold", "Book", "Demi", "Heavy", "Light",
 118                        "Meduium", "Nord", "Poster", "Regular", "Super", "Thin",
 119                        "Compressed", "Condensed", "Compact", "Extended", "Narrow",
 120                        "Inclined", "Italic", "Kursiv", "Oblique", "Upright", "Sloped",
 121                        "Semi", "Ultra", "Extra",
 122                        "Alternate", "Alternate", "Deutsche Fraktur", "Expert", "Inline", "Ornaments",
 123                        "Outline", "Roman", "Rounded", "Script", "Shaded", "Swash", "Titling", "Typewriter"};
 124         String abbrv[] = {"Blk", "Bd", "Bk", "Dm", "Hv", "Lt",
 125                           "Md", "Nd", "Po", "Rg", "Su", "Th",
 126                           "Cm", "Cn", "Ct", "Ex", "Nr",
 127                           "Ic", "It", "Ks", "Obl", "Up", "Sl",
 128                           "Sm", "Ult", "X",
 129                           "A", "Alt", "Dfr", "Exp", "In", "Or",
 130                           "Ou", "Rm", "Rd", "Scr", "Sh", "Sw", "Ti", "Typ"};
 131        /* This is only subset of names from nm[] because we want to distinguish things
 132            like "Lucida Sans TypeWriter Bold" and "Lucida Sans Bold".
 133            Names from "Design and/or special purpose" group are omitted. */
 134        String styleTokens[] = {"Black", "Bold", "Book", "Demi", "Heavy", "Light",
 135                        "Medium", "Nord", "Poster", "Regular", "Super", "Thin",
 136                        "Compressed", "Condensed", "Compact", "Extended", "Narrow",
 137                        "Inclined", "Italic", "Kursiv", "Oblique", "Upright", "Sloped", "Slanted",
 138                        "Semi", "Ultra", "Extra"};
 139 
 140         for(int i=0; i<nm.length; i++) {
 141             styleAbbreviationsMapping.put(abbrv[i], nm[i]);
 142         }
 143         for(int i=0; i<styleTokens.length; i++) {
 144             styleNameTokes.add(styleTokens[i]);
 145         }
 146         }
 147 
 148 
 149     /**
 150      * Constructs a Type1 Font.
 151      * @param platname - Platform identifier of the font. Typically file name.
 152      * @param nativeNames - Native names - typically XLFDs on Unix.
 153      */
 154     public Type1Font(String platname, Object nativeNames)


   1 /*
   2  * Copyright (c) 2003, 2018, 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


  97              });
  98         }
  99     }
 100 
 101     WeakReference<Object> bufferRef = new WeakReference<>(null);
 102 
 103     private String psName = null;
 104 
 105     private static HashMap<String, String> styleAbbreviationsMapping;
 106     private static HashSet<String> styleNameTokes;
 107 
 108     static {
 109         styleAbbreviationsMapping = new HashMap<>();
 110         styleNameTokes = new HashSet<>();
 111 
 112         /* These abbreviation rules are taken from Appendix 1 of Adobe Technical Note #5088 */
 113         /* NB: this list is not complete - we did not include abbreviations which contain
 114                several capital letters because current expansion algorithm do not support this.
 115                (namely we have omited MM aka "Multiple Master", OsF aka "Oldstyle figures",
 116                            OS aka "Oldstyle", SC aka "Small caps" and  DS aka "Display" */
 117         String[] nm = {"Black", "Bold", "Book", "Demi", "Heavy", "Light",
 118                        "Meduium", "Nord", "Poster", "Regular", "Super", "Thin",
 119                        "Compressed", "Condensed", "Compact", "Extended", "Narrow",
 120                        "Inclined", "Italic", "Kursiv", "Oblique", "Upright", "Sloped",
 121                        "Semi", "Ultra", "Extra",
 122                        "Alternate", "Alternate", "Deutsche Fraktur", "Expert", "Inline", "Ornaments",
 123                        "Outline", "Roman", "Rounded", "Script", "Shaded", "Swash", "Titling", "Typewriter"};
 124         String[] abbrv = {"Blk", "Bd", "Bk", "Dm", "Hv", "Lt",
 125                           "Md", "Nd", "Po", "Rg", "Su", "Th",
 126                           "Cm", "Cn", "Ct", "Ex", "Nr",
 127                           "Ic", "It", "Ks", "Obl", "Up", "Sl",
 128                           "Sm", "Ult", "X",
 129                           "A", "Alt", "Dfr", "Exp", "In", "Or",
 130                           "Ou", "Rm", "Rd", "Scr", "Sh", "Sw", "Ti", "Typ"};
 131        /* This is only subset of names from nm[] because we want to distinguish things
 132            like "Lucida Sans TypeWriter Bold" and "Lucida Sans Bold".
 133            Names from "Design and/or special purpose" group are omitted. */
 134        String[] styleTokens = {"Black", "Bold", "Book", "Demi", "Heavy", "Light",
 135                        "Medium", "Nord", "Poster", "Regular", "Super", "Thin",
 136                        "Compressed", "Condensed", "Compact", "Extended", "Narrow",
 137                        "Inclined", "Italic", "Kursiv", "Oblique", "Upright", "Sloped", "Slanted",
 138                        "Semi", "Ultra", "Extra"};
 139 
 140         for(int i=0; i<nm.length; i++) {
 141             styleAbbreviationsMapping.put(abbrv[i], nm[i]);
 142         }
 143         for(int i=0; i<styleTokens.length; i++) {
 144             styleNameTokes.add(styleTokens[i]);
 145         }
 146         }
 147 
 148 
 149     /**
 150      * Constructs a Type1 Font.
 151      * @param platname - Platform identifier of the font. Typically file name.
 152      * @param nativeNames - Native names - typically XLFDs on Unix.
 153      */
 154     public Type1Font(String platname, Object nativeNames)


< prev index next >