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

Print this page




 857                 /* NIO I/O is interruptible, recurse to retry operation.
 858                  * Clear interrupts before recursing in case NIO didn't.
 859                  */
 860                 Thread.interrupted();
 861                 close();
 862                 return getTableBuffer(tag);
 863             } catch (IOException e) {
 864                 return null;
 865             } catch (FontFormatException e) {
 866                 return null;
 867             }
 868 
 869             if (bread < entry.length) {
 870                 return null;
 871             } else {
 872                 return buffer;
 873             }
 874         }
 875     }
 876 
 877     /* NB: is it better to move declaration to Font2D? */
 878     long getLayoutTableCache() {
 879         try {
 880           return getScaler().getLayoutTableCache();
 881         } catch(FontScalerException fe) {
 882             return 0L;
 883         }
 884     }
 885 
 886     @Override
 887     byte[] getTableBytes(int tag) {
 888         ByteBuffer buffer = getTableBuffer(tag);
 889         if (buffer == null) {
 890             return null;
 891         } else if (buffer.hasArray()) {
 892             try {
 893                 return buffer.array();
 894             } catch (Exception re) {
 895             }
 896         }
 897         byte []data = new byte[getTableSize(tag)];
 898         buffer.get(data);
 899         return data;
 900     }
 901 
 902     int getTableSize(int tag) {
 903         for (int i=0;i<numTables;i++) {
 904             if (tableDirectory[i].tag == tag) {
 905                 return tableDirectory[i].length;
 906             }
 907         }




 857                 /* NIO I/O is interruptible, recurse to retry operation.
 858                  * Clear interrupts before recursing in case NIO didn't.
 859                  */
 860                 Thread.interrupted();
 861                 close();
 862                 return getTableBuffer(tag);
 863             } catch (IOException e) {
 864                 return null;
 865             } catch (FontFormatException e) {
 866                 return null;
 867             }
 868 
 869             if (bread < entry.length) {
 870                 return null;
 871             } else {
 872                 return buffer;
 873             }
 874         }
 875     }
 876 
 877     @Override
 878     protected long getLayoutTableCache() {
 879         try {
 880           return getScaler().getLayoutTableCache();
 881         } catch(FontScalerException fe) {
 882             return 0L;
 883         }
 884     }
 885 
 886     @Override
 887     protected byte[] getTableBytes(int tag) {
 888         ByteBuffer buffer = getTableBuffer(tag);
 889         if (buffer == null) {
 890             return null;
 891         } else if (buffer.hasArray()) {
 892             try {
 893                 return buffer.array();
 894             } catch (Exception re) {
 895             }
 896         }
 897         byte []data = new byte[getTableSize(tag)];
 898         buffer.get(data);
 899         return data;
 900     }
 901 
 902     int getTableSize(int tag) {
 903         for (int i=0;i<numTables;i++) {
 904             if (tableDirectory[i].tag == tag) {
 905                 return tableDirectory[i].length;
 906             }
 907         }