APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.font

public final Class StrikeCache

extends Object
Class Inheritance
Imports
java.awt.GraphicsConfiguration, .GraphicsEnvironment, java.lang.foreign.MemoryLayout, .MemorySegment, .StructLayout, .ValueLayout, java.lang.invoke.MethodHandles, .VarHandle, java.lang.ref.Reference, .ReferenceQueue, .SoftReference, .WeakReference, java.util.*, sun.java2d.Disposer, sun.java2d.pipe.BufferedContext, .RenderQueue, sun.java2d.pipe.hw.AccelGraphicsConfig

A FontStrike is the keeper of scaled glyph image data which is expensive to compute so needs to be cached. So long as that data may be being used it cannot be invalidated. Yet we also need to limit the amount of native memory and number of strike objects in use. For scalability and ease of use, a key goal is multi-threaded read access to a strike, so that it may be shared by multiple client objects, potentially executing on different threads, with no special reference counting or "check-out/check-in" requirements which would pass on the burden of keeping track of strike references to the SG2D and other clients. A cache of strikes is maintained via Reference objects. This helps in two ways : 1. The VM will free references when memory is low or they have not been used in a long time. 2. Reference queues provide a way to get notification of this so we can free native memory resources.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static interface
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static boolean
private static final VarHandle
pack-priv static ArrayList<GlyphDisposedListener>
public static final StructLayout
private static final long
private static final VarHandle
private static final VarHandle
pack-priv static final long
private static final VarHandle
pack-priv static int
pack-priv static final int
pack-priv static int
pack-priv static FontStrike[]
pack-priv static ReferenceQueue<Object>
private static final VarHandle
private static final VarHandle
private static final VarHandle
private static final VarHandle
private static final VarHandle
private static final VarHandle

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
pack-priv static void
private static void
private static void
freeCachedIntMemory(int[] glyphPtrs, long pContext)

private static void
freeCachedLongMemory(long[] glyphPtrs, long pContext)

private static native void
freeIntMemory(int[] glyphPtrs, long pContext)

pack-priv static native void
freeIntPointer(int ptr)

private static native void
freeLongMemory(long[] glyphPtrs, long pContext)

pack-priv static native void
freeLongPointer(long ptr)

pack-priv static final long
getGlyphCellInfo(long ptr)

pack-priv static final char
getGlyphHeight(long ptr)

pack-priv static final long
getGlyphImagePtr(long ptr)

pack-priv static final byte
getGlyphManaged(long ptr)

pack-priv static final byte[]
pack-priv static final MemorySegment
pack-priv static final char
getGlyphRowBytes(long ptr)

pack-priv static final float
getGlyphTopLeftX(long ptr)

pack-priv static final float
getGlyphTopLeftY(long ptr)

pack-priv static final char
getGlyphWidth(long ptr)

pack-priv static final float
getGlyphXAdvance(long ptr)

pack-priv static final float
getGlyphYAdvance(long ptr)

pack-priv static native long
pack-priv static final byte
getPixelByte(MemorySegment pixelData, long index)

public static Reference<FontStrike>
public static Reference<FontStrike>
getStrikeRef(FontStrike strike, boolean weak)

private static VarHandle
private static void
private static boolean
private static void
pack-priv static void
pack-priv static final void
setGlyphCellInfo(long ptr, long val)

pack-priv static final void
setGlyphXAdvance(long ptr, float val)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheRefTypeWeakback to summary
pack-priv static boolean cacheRefTypeWeak
cellInfoHandleback to summary
private static final VarHandle cellInfoHandle
disposeListenersback to summary
pack-priv static ArrayList<GlyphDisposedListener> disposeListeners
GlyphImageLayoutback to summary
public static final StructLayout GlyphImageLayout
GLYPHIMAGESIZEback to summary
private static final long GLYPHIMAGESIZE
heightHandleback to summary
private static final VarHandle heightHandle
imageHandleback to summary
private static final VarHandle imageHandle
invisibleGlyphPtrback to summary
pack-priv static final long invisibleGlyphPtr
managedHandleback to summary
private static final VarHandle managedHandle
MINSTRIKESback to summary
pack-priv static int MINSTRIKES
nativeAddressSizeback to summary
pack-priv static final int nativeAddressSize
recentStrikeIndexback to summary
pack-priv static int recentStrikeIndex
recentStrikesback to summary
pack-priv static FontStrike[] recentStrikes
refQueueback to summary
pack-priv static ReferenceQueue<Object> refQueue
rowBytesHandleback to summary
private static final VarHandle rowBytesHandle
topLeftXHandleback to summary
private static final VarHandle topLeftXHandle
topLeftYHandleback to summary
private static final VarHandle topLeftYHandle
widthHandleback to summary
private static final VarHandle widthHandle
xAdvanceHandleback to summary
private static final VarHandle xAdvanceHandle
yAdvanceHandleback to summary
private static final VarHandle yAdvanceHandle

Constructor Detail

StrikeCacheback to summary
public StrikeCache()

Method Detail

addGlyphDisposedListenerback to summary
public static void addGlyphDisposedListener(GlyphDisposedListener listener)
disposeStrikeback to summary
pack-priv static void disposeStrike(final FontStrikeDisposer disposer)
doDisposeback to summary
private static void doDispose(FontStrikeDisposer disposer)
freeCachedIntMemoryback to summary
private static void freeCachedIntMemory(int[] glyphPtrs, long pContext)
freeCachedLongMemoryback to summary
private static void freeCachedLongMemory(long[] glyphPtrs, long pContext)
freeIntMemoryback to summary
private static native void freeIntMemory(int[] glyphPtrs, long pContext)
freeIntPointerback to summary
pack-priv static native void freeIntPointer(int ptr)
freeLongMemoryback to summary
private static native void freeLongMemory(long[] glyphPtrs, long pContext)
freeLongPointerback to summary
pack-priv static native void freeLongPointer(long ptr)
getGlyphCellInfoback to summary
pack-priv static final long getGlyphCellInfo(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphHeightback to summary
pack-priv static final char getGlyphHeight(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphImagePtrback to summary
pack-priv static final long getGlyphImagePtr(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphManagedback to summary
pack-priv static final byte getGlyphManaged(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphPixelBytesback to summary
pack-priv static final byte[] getGlyphPixelBytes(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphPixelDataback to summary
pack-priv static final MemorySegment getGlyphPixelData(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphRowBytesback to summary
pack-priv static final char getGlyphRowBytes(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphTopLeftXback to summary
pack-priv static final float getGlyphTopLeftX(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphTopLeftYback to summary
pack-priv static final float getGlyphTopLeftY(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphWidthback to summary
pack-priv static final char getGlyphWidth(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphXAdvanceback to summary
pack-priv static final float getGlyphXAdvance(long ptr)
Annotations
@SuppressWarnings:restricted
getGlyphYAdvanceback to summary
pack-priv static final float getGlyphYAdvance(long ptr)
Annotations
@SuppressWarnings:restricted
getInvisibleGlyphPtrback to summary
pack-priv static native long getInvisibleGlyphPtr()
getPixelByteback to summary
pack-priv static final byte getPixelByte(MemorySegment pixelData, long index)
getStrikeRefback to summary
public static Reference<FontStrike> getStrikeRef(FontStrike strike)
getStrikeRefback to summary
public static Reference<FontStrike> getStrikeRef(FontStrike strike, boolean weak)
getVarHandleback to summary
private static VarHandle getVarHandle(StructLayout struct, String name)
initStaticback to summary
private static void initStatic()
longAddressesback to summary
private static boolean longAddresses()
notifyDisposeListenersback to summary
private static void notifyDisposeListeners(ArrayList<Long> glyphs)
refStrikeback to summary
pack-priv static void refStrike(FontStrike strike)
setGlyphCellInfoback to summary
pack-priv static final void setGlyphCellInfo(long ptr, long val)
Annotations
@SuppressWarnings:restricted
setGlyphXAdvanceback to summary
pack-priv static final void setGlyphXAdvance(long ptr, float val)
Annotations
@SuppressWarnings:restricted
sun.font back to summary

pack-priv Interface StrikeCache.DisposableStrike

Known Direct Implementers
sun.font.StrikeCache.SoftDisposerRef, sun.font.StrikeCache.WeakDisposerRef

Method Summary

Modifier and TypeMethod and Description
public FontStrikeDisposer

Method Detail

getDisposerback to summary
public FontStrikeDisposer getDisposer()
sun.font back to summary

pack-priv Class StrikeCache.SoftDisposerRef

extends SoftReference<FontStrike>
implements DisposableStrike
Class Inheritance
All Implemented Interfaces
sun.font.StrikeCache.DisposableStrike

Field Summary

Modifier and TypeField and Description
private FontStrikeDisposer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public FontStrikeDisposer
Inherited from java.lang.ref.SoftReference:
get

Field Detail

disposerback to summary
private FontStrikeDisposer disposer

Constructor Detail

SoftDisposerRefback to summary
pack-priv SoftDisposerRef(FontStrike strike)
Annotations
@SuppressWarnings:unchecked

Method Detail

getDisposerback to summary
public FontStrikeDisposer getDisposer()

Implements sun.font.StrikeCache.DisposableStrike.getDisposer.

sun.font back to summary

pack-priv Class StrikeCache.WeakDisposerRef

extends WeakReference<FontStrike>
implements DisposableStrike
Class Inheritance
All Implemented Interfaces
sun.font.StrikeCache.DisposableStrike

Field Summary

Modifier and TypeField and Description
private FontStrikeDisposer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public FontStrikeDisposer

Field Detail

disposerback to summary
private FontStrikeDisposer disposer

Constructor Detail

WeakDisposerRefback to summary
pack-priv WeakDisposerRef(FontStrike strike)
Annotations
@SuppressWarnings:unchecked

Method Detail

getDisposerback to summary
public FontStrikeDisposer getDisposer()

Implements sun.font.StrikeCache.DisposableStrike.getDisposer.