< prev index next >

src/java.desktop/unix/classes/sun/font/NativeStrike.java

Print this page
rev 60064 : 8248802: Add log helper methods to FontUtilities.java
   1 /*
   2  * Copyright (c) 2003, 2012, 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


  99           * true, just bail
 100           */
 101          if (nativeFont.isBitmapDelegate) {
 102              int ttype = desc.glyphTx.getType();
 103              if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
 104                  desc.glyphTx.getScaleX() <= 0) {
 105              numGlyphs = 0;
 106              return;
 107              }
 108          }
 109 
 110          int ptSize = getNativePointSize();
 111          byte [] nameBytes = nativeFont.getPlatformNameBytes(ptSize);
 112          double scale = Math.abs(desc.devTx.getScaleX());
 113          pScalerContext = createScalerContext(nameBytes, ptSize, scale);
 114          if (pScalerContext == 0L) {
 115              SunFontManager.getInstance().deRegisterBadFont(nativeFont);
 116              pScalerContext = createNullScalerContext();
 117              numGlyphs = 0;
 118              if (FontUtilities.isLogging()) {
 119                  FontUtilities.getLogger()
 120                                    .severe("Could not create native strike " +
 121                                            new String(nameBytes));
 122              }
 123              return;
 124          }
 125          numGlyphs = nativeFont.getMapper().getNumGlyphs();
 126          this.disposer = new NativeStrikeDisposer(nativeFont, desc,
 127                                                   pScalerContext);
 128      }
 129 
 130      /* The asymmetry of the following methods is to help preserve
 131       * performance with minimal textual changes to the calling code
 132       * when moving initialisation of these arrays out of the constructor.
 133       * This may be restructured later when there's more room for changes
 134       */
 135      private boolean usingIntGlyphImages() {
 136          if (intGlyphImages != null) {
 137             return true;
 138         } else if (longAddresses) {
 139             return false;
 140         } else {


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


  99           * true, just bail
 100           */
 101          if (nativeFont.isBitmapDelegate) {
 102              int ttype = desc.glyphTx.getType();
 103              if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
 104                  desc.glyphTx.getScaleX() <= 0) {
 105              numGlyphs = 0;
 106              return;
 107              }
 108          }
 109 
 110          int ptSize = getNativePointSize();
 111          byte [] nameBytes = nativeFont.getPlatformNameBytes(ptSize);
 112          double scale = Math.abs(desc.devTx.getScaleX());
 113          pScalerContext = createScalerContext(nameBytes, ptSize, scale);
 114          if (pScalerContext == 0L) {
 115              SunFontManager.getInstance().deRegisterBadFont(nativeFont);
 116              pScalerContext = createNullScalerContext();
 117              numGlyphs = 0;
 118              if (FontUtilities.isLogging()) {
 119                  FontUtilities.logSevere("Could not create native strike " +

 120                                          new String(nameBytes));
 121              }
 122              return;
 123          }
 124          numGlyphs = nativeFont.getMapper().getNumGlyphs();
 125          this.disposer = new NativeStrikeDisposer(nativeFont, desc,
 126                                                   pScalerContext);
 127      }
 128 
 129      /* The asymmetry of the following methods is to help preserve
 130       * performance with minimal textual changes to the calling code
 131       * when moving initialisation of these arrays out of the constructor.
 132       * This may be restructured later when there's more room for changes
 133       */
 134      private boolean usingIntGlyphImages() {
 135          if (intGlyphImages != null) {
 136             return true;
 137         } else if (longAddresses) {
 138             return false;
 139         } else {


< prev index next >