1 /* 2 * Copyright (c) 2003, 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 23 * questions. 24 */ 25 26 package sun.font; 27 28 import java.awt.Rectangle; 29 import java.awt.geom.GeneralPath; 30 import java.awt.geom.Rectangle2D; 31 import java.awt.geom.Point2D; 32 33 public abstract class FontStrike { 34 35 36 protected FontStrikeDisposer disposer; 37 protected FontStrikeDesc desc; 38 protected StrikeMetrics strikeMetrics; 39 protected boolean algoStyle = false; 40 protected float boldness = 1f; 41 protected float italic = 0f; 42 /* 43 * lastLookupTime is updated by Font2D.getStrike and can be used to 44 * choose strikes that have not been newly referenced for purging when 45 * memory usage gets too high. Active strikes will never be purged 46 * because purging is via GC of WeakReferences. 47 */ 48 //protected long lastlookupTime/* = System.currentTimeMillis()*/; 49 getNumGlyphs()50 public abstract int getNumGlyphs(); 51 getFontMetrics()52 abstract StrikeMetrics getFontMetrics(); 53 getGlyphImagePtrs(int[] glyphCodes, long[] images,int len)54 abstract void getGlyphImagePtrs(int[] glyphCodes, long[] images,int len); 55 getGlyphImagePtr(int glyphcode)56 abstract long getGlyphImagePtr(int glyphcode); 57 58 // pt, result in device space getGlyphImageBounds(int glyphcode, Point2D.Float pt, Rectangle result)59 abstract void getGlyphImageBounds(int glyphcode, 60 Point2D.Float pt, 61 Rectangle result); 62 getGlyphMetrics(int glyphcode)63 abstract Point2D.Float getGlyphMetrics(int glyphcode); 64 getCharMetrics(char ch)65 abstract Point2D.Float getCharMetrics(char ch); 66 getGlyphAdvance(int glyphCode)67 abstract float getGlyphAdvance(int glyphCode); 68 getCodePointAdvance(int cp)69 abstract float getCodePointAdvance(int cp); 70 getGlyphOutlineBounds(int glyphCode)71 abstract Rectangle2D.Float getGlyphOutlineBounds(int glyphCode); 72 73 abstract GeneralPath getGlyphOutline(int glyphCode, float x, float y)74 getGlyphOutline(int glyphCode, float x, float y); 75 76 abstract GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y)77 getGlyphVectorOutline(int[] glyphs, float x, float y); 78 79 80 } 81