| java.lang.Object org.apache.harmony.awt.gl.font.LinuxNativeFont
LinuxNativeFont | public class LinuxNativeFont (Code) | | Library wrapper of native linux font functions.
|
Field Summary | |
final public static int | FC_SLANT_ITALIC | final public static int | FC_SLANT_OBLIQUE | final public static int | FC_SLANT_ROMAN | final public static int | FC_WEIGHT_MEDIUM | public static String[] | faces List of font faces names of system fonts supported by a system. | public static int | facesCount The number of different fonts installed onto the system. | public static int[] | famIndices List of family indexes in families array corresponding to the faces
indexing. | public static Vector | fams Set of all unique families installed onto the system. | public static int[] | fontStyles List of font styles of system fonts supported by a system
corresponding to faces indexing. | public static String[] | styleNames List of font style names of system fonts supported by a system
corresponding to faces indexing. |
Method Summary | |
native public static synchronized void | NativeFreeGlyphBitmap(long bitmap) Disposes memory block that is used by FreeType FT_Bitmap structure
by pointer specified. | native public static synchronized long | NativeInitGlyphBitmap(long fnt, char chr) Returns pointer to GlyphBitmap structure that represents bitmap
with parameters of the character specified or 0 if failures
in native code. | native public static synchronized int | RemoveFontResource(String tempFontFileName) Updates specified folder where temporary font created from InputStream stored.
This method used in LinuxFont dispose method, it re-caches ~/.fonts
directory, after temporary font file is deleted.
Parameters: tempFontFileName - directory that is being re-cached name. | native public static boolean | XftDrawSetClipRectangles(long xftDraw, int xOrigin, int yOrigin, long rects, int n) Sets clipping rectangles in Xft drawable to the specified clipping rectangles. | native public static synchronized boolean | canDisplayCharNative(long hndFont, char c) Returns true, if XftFont object can display specified char. | native public static synchronized long | createXftDrawNative(long display, long drawable, long visual) Returns XftDraw handle created from specified parameters using Xft library. | native public static synchronized void | drawStringNative(long xftDraw, long display, long colormap, long font, int x, int y, char[] chars, int len, long xcolor) Draws text on XftDraw with specified parameters using Xft library. | public static Font | embedFont(String absolutePath) Adds new plain font with 1 pt. | native public static synchronized String | embedFontNative(String absolutePath) Returns true if the new font was added to the system, false
otherwise. | native public static synchronized void | freeGlyphOutline(long ptr) Disposes memory block that is used by FreeType FT_Outline structure
by pointer specified. | native public static synchronized void | freeXftDrawNative(long xftDraw) Destroys XftDraw object. | public static Font[] | getAllFonts() Returns an array of instances of 1 pt. | native public static long | getAntialiasedFont(long font, long display, boolean isAntialiasing) | native public static synchronized float[] | getExtraMetricsNative(long hFont, int fontSize, int fontType) Returns an array of extrametrics of the font:
elem[0] - the average width of characters in the font (Type1 - 0.0f)
elem[1] - horizontal size for subscripts (Type1 - 0.7f * fontHeight)
elem[2] - vertical size for subscripts (Type1 - 0.65f * fontHeight)
elem[3] - horizontal offset for subscripts (Type1 - 0.0f)
elem[4] - vertical offset value for subscripts(Type1 - 0.15f * fontHeight)
elem[5] - horizontal size for superscripts (Type1 - 0.7f * fontHeight)
elem[6] - vertical size for superscripts (Type1 - 0.65f * fontHeight)
elem[7] - horizontal offset for superscripts (Type1 - 0.0f)
elem[8] - vertical offset for superscripts (Type1 - 0.45f * fontHeight)
For TrueType fonts metrics are taken from OS2 table, for Type1 fonts
metrics are calculated using coefficients (read FontExtraMetrics comments). | public static String[] | getFaces() Returns array of Strings that represent face names of all fonts
supported by a system. | public static String[] | getFamilies() Returns the list of system font families names. | public static String | getFamilyFromFaceIndex(int faceIndex) Returns family name that corresponds to the face with specified
face index. | native public static synchronized String | getFamilyNative(long hndFont) Returns family name of the XftFont object. | native public static synchronized String[] | getFontFamiliesNames() Returns array of Strings that represents list of all font families names
available on the system. | native public static synchronized String | getFontNameNative(long hndFont) Returns face name of the XftFont object. | native public static synchronized String | getFontPSNameNative(long fnt) Returns XftFont's postscript name.
Returned value is the name of the font in system default locale or
for english langid if there is no results for default locale settings. | public static int | getFontStyle(int faceIndex) Returns font style of the font with face having specified index. | public static String | getFontStyleName(int faceIndex) Returns font style name of the font with face having specified index. | native public static synchronized String[] | getFonts() Returns an array of available system fonts names. | native public static synchronized int | getGlyphCodeNative(long fnt, char uChar, long display) Returns glyph code corresponding to the specified character, null is
returned if failure. | native public static synchronized int[] | getGlyphCodesNative(long fnt, String str, int len) Returns glyphs code corresponding to the characters in String specified, null
is returned if failure. | native public static synchronized float[] | getGlyphInfoNative(long pFnt, char c, int fontSize) Returns array of glyph metrics values for the specified character
null is returned and NullPointerException is thrown in case of FreeType
errors. | native public static synchronized long | getGlyphOutline(long pFont, char c) Returns pointer to the FreeType FT_Outline structure. | native public static synchronized int[] | getGlyphPxlInfoNative(long display, long pFnt, char c) Returns array of glyph metrics values in pixels for the specified character
null is returned and NullPointerException is thrown in case of FreeType errors. | native public static synchronized float | getItalicAngleNative(long hndFont, int fontType) Returns tangent of Italic angle of given Font. | native public static synchronized float[] | getNativeLineMetrics(long hFont, int fontSize, boolean isAntialiased, boolean usesFractionalMetrics, int fontType) Returns array of values of font metrics corresponding to the given XftFont
font object. | native public static synchronized int | getNumGlyphsNative(long hndFont) Returns number of glyphs in specified XftFont if success. | native public static synchronized float[] | getPointsFromFTVector(long ft_vector, int size) Returns an array of pairs of coordinates [x1, y1, x2, y2...] from
FreeType FT_Vector structure. | public static void | initFace(int index, String faceString) Initializes specified elements with index specified of famIndices, styles and
faces arrays according to the given faceString. | public static void | initFaces() Initializes famIndices, styles, style names and faces arrays
according to the font information available on the system. | public static void | initLCIDsTable(Hashtable ht) | native public static synchronized long | initializeFont(LinuxFont linFont, String family, int style, int size, String styleName) Initiailzes native Xft font object from specified parameters and returns
font handle, also sets font type to the font peer parameter. | static void | loadLibrary() | native public static synchronized void | pFontFree(long hndFont, long display) Disposing XftFont object. | native public static void | xftDrawSetSubwindowModeNative(long xftDraw, int mode) |
FC_SLANT_ITALIC | final public static int FC_SLANT_ITALIC(Code) | | |
FC_SLANT_OBLIQUE | final public static int FC_SLANT_OBLIQUE(Code) | | |
FC_SLANT_ROMAN | final public static int FC_SLANT_ROMAN(Code) | | |
FC_WEIGHT_MEDIUM | final public static int FC_WEIGHT_MEDIUM(Code) | | |
faces | public static String[] faces(Code) | | List of font faces names of system fonts supported by a system.
|
facesCount | public static int facesCount(Code) | | The number of different fonts installed onto the system.
|
famIndices | public static int[] famIndices(Code) | | List of family indexes in families array corresponding to the faces
indexing.
|
fams | public static Vector fams(Code) | | Set of all unique families installed onto the system.
|
fontStyles | public static int[] fontStyles(Code) | | List of font styles of system fonts supported by a system
corresponding to faces indexing.
|
styleNames | public static String[] styleNames(Code) | | List of font style names of system fonts supported by a system
corresponding to faces indexing.
|
NativeFreeGlyphBitmap | native public static synchronized void NativeFreeGlyphBitmap(long bitmap)(Code) | | Disposes memory block that is used by FreeType FT_Bitmap structure
by pointer specified.
Parameters: ptr - specified pointer to the memory block |
NativeInitGlyphBitmap | native public static synchronized long NativeInitGlyphBitmap(long fnt, char chr)(Code) | | Returns pointer to GlyphBitmap structure that represents bitmap
with parameters of the character specified or 0 if failures
in native code.
Parameters: fnt - XftFont handle Parameters: chr - specified char |
RemoveFontResource | native public static synchronized int RemoveFontResource(String tempFontFileName)(Code) | | Updates specified folder where temporary font created from InputStream stored.
This method used in LinuxFont dispose method, it re-caches ~/.fonts
directory, after temporary font file is deleted.
Parameters: tempFontFileName - directory that is being re-cached name. not null value if success, 0 otherwise |
XftDrawSetClipRectangles | native public static boolean XftDrawSetClipRectangles(long xftDraw, int xOrigin, int yOrigin, long rects, int n)(Code) | | Sets clipping rectangles in Xft drawable to the specified clipping rectangles.
Parameters: xftDraw - XftDraw handle Parameters: xOrigin - x position to start Parameters: yOrigin - y position to start Parameters: rects - handle to the memory block representing XRectangles array Parameters: n - number of rectangles result true if success in native call, false otherwise |
canDisplayCharNative | native public static synchronized boolean canDisplayCharNative(long hndFont, char c)(Code) | | Returns true, if XftFont object can display specified char.
Parameters: hndFont - XftFont handle Parameters: c - specified char |
createXftDrawNative | native public static synchronized long createXftDrawNative(long display, long drawable, long visual)(Code) | | Returns XftDraw handle created from specified parameters using Xft library.
Parameters: display - Display handle Parameters: drawable - Drawable handle Parameters: visual - Visual handle |
drawStringNative | native public static synchronized void drawStringNative(long xftDraw, long display, long colormap, long font, int x, int y, char[] chars, int len, long xcolor)(Code) | | Draws text on XftDraw with specified parameters using Xft library.
Parameters: xftDraw - XftDraw handle Parameters: display - Display handle Parameters: colormap - Colormap handle Parameters: font - XftFont handle Parameters: x - X coordinate where to draw at Parameters: y - Y coordinate where to draw at Parameters: chars - array of chars to draw Parameters: len - length of the array of chars Parameters: xcolor - XColor handle, the color of the text |
embedFont | public static Font embedFont(String absolutePath) throws IOException(Code) | | Adds new plain font with 1 pt. size from font resource file to the
system if similar font wasn't into the system before. Method returns
font object, corresponding to the specified resource.
Parameters: absolutePath - absolute path to the font resource file |
embedFontNative | native public static synchronized String embedFontNative(String absolutePath)(Code) | | Returns true if the new font was added to the system, false
otherwise. Methods checks if the number of system fonts
changed after font configuration was rebuilt.
Parameters: absolutePath - absolute path to the font. |
freeGlyphOutline | native public static synchronized void freeGlyphOutline(long ptr)(Code) | | Disposes memory block that is used by FreeType FT_Outline structure
by pointer specified.
Parameters: ptr - specified pointer to the memory block |
freeXftDrawNative | native public static synchronized void freeXftDrawNative(long xftDraw)(Code) | | Destroys XftDraw object.
Parameters: xftDraw - XftDraw handle |
getAllFonts | public static Font[] getAllFonts()(Code) | | Returns an array of instances of 1 pt. sized plain Font objects
corresponding to fonts supported by a system.
|
getAntialiasedFont | native public static long getAntialiasedFont(long font, long display, boolean isAntialiasing)(Code) | | Getting antialiasing font from existing font
|
getExtraMetricsNative | native public static synchronized float[] getExtraMetricsNative(long hFont, int fontSize, int fontType)(Code) | | Returns an array of extrametrics of the font:
elem[0] - the average width of characters in the font (Type1 - 0.0f)
elem[1] - horizontal size for subscripts (Type1 - 0.7f * fontHeight)
elem[2] - vertical size for subscripts (Type1 - 0.65f * fontHeight)
elem[3] - horizontal offset for subscripts (Type1 - 0.0f)
elem[4] - vertical offset value for subscripts(Type1 - 0.15f * fontHeight)
elem[5] - horizontal size for superscripts (Type1 - 0.7f * fontHeight)
elem[6] - vertical size for superscripts (Type1 - 0.65f * fontHeight)
elem[7] - horizontal offset for superscripts (Type1 - 0.0f)
elem[8] - vertical offset for superscripts (Type1 - 0.45f * fontHeight)
For TrueType fonts metrics are taken from OS2 table, for Type1 fonts
metrics are calculated using coefficients (read FontExtraMetrics comments).
OS2 table can be found at http://www.freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#TT_OS2
Parameters: hFont - XFT font handle Parameters: fontSize - font size Parameters: fontType - type of the font |
getFaces | public static String[] getFaces()(Code) | | Returns array of Strings that represent face names of all fonts
supported by a system.
|
getFamilies | public static String[] getFamilies()(Code) | | Returns the list of system font families names.
|
getFamilyFromFaceIndex | public static String getFamilyFromFaceIndex(int faceIndex)(Code) | | Returns family name that corresponds to the face with specified
face index.
Parameters: faceIndex - index of the face in faces array |
getFamilyNative | native public static synchronized String getFamilyNative(long hndFont)(Code) | | Returns family name of the XftFont object.
Parameters: hndFont - XftFont handle |
getFontFamiliesNames | native public static synchronized String[] getFontFamiliesNames()(Code) | | Returns array of Strings that represents list of all font families names
available on the system.
|
getFontNameNative | native public static synchronized String getFontNameNative(long hndFont)(Code) | | Returns face name of the XftFont object.
Parameters: hndFont - XftFont handle |
getFontPSNameNative | native public static synchronized String getFontPSNameNative(long fnt)(Code) | | Returns XftFont's postscript name.
Returned value is the name of the font in system default locale or
for english langid if there is no results for default locale settings.
Parameters: fnt - XftFont handle |
getFontStyle | public static int getFontStyle(int faceIndex)(Code) | | Returns font style of the font with face having specified index.
Parameters: faceIndex - specified index of the face in faces array |
getFontStyleName | public static String getFontStyleName(int faceIndex)(Code) | | Returns font style name of the font with face having specified index.
Parameters: faceIndex - specified index of the face in faces array |
getFonts | native public static synchronized String[] getFonts()(Code) | | Returns an array of available system fonts names.
In case of errors in native code NullPointerException is thrown.
|
getGlyphCodeNative | native public static synchronized int getGlyphCodeNative(long fnt, char uChar, long display)(Code) | | Returns glyph code corresponding to the specified character, null is
returned if failure. NullPointerException is thrown in case of Display is null.
Parameters: fnt - XftFont handle Parameters: uChar - specified char Parameters: display - Display handle |
getGlyphCodesNative | native public static synchronized int[] getGlyphCodesNative(long fnt, String str, int len)(Code) | | Returns glyphs code corresponding to the characters in String specified, null
is returned if failure. NullPointerException is thrown in case of Display
is null.
Parameters: fnt - XftFont handle Parameters: uChar - specified char Parameters: display - Display handle |
getGlyphInfoNative | native public static synchronized float[] getGlyphInfoNative(long pFnt, char c, int fontSize)(Code) | | Returns array of glyph metrics values for the specified character
null is returned and NullPointerException is thrown in case of FreeType
errors.
Parameters: pFnt - XftFont handle Parameters: c - specified char |
getGlyphOutline | native public static synchronized long getGlyphOutline(long pFont, char c)(Code) | | Returns pointer to the FreeType FT_Outline structure.
Parameters: pFont - XFT font handle Parameters: c - specified character |
getGlyphPxlInfoNative | native public static synchronized int[] getGlyphPxlInfoNative(long display, long pFnt, char c)(Code) | | Returns array of glyph metrics values in pixels for the specified character
null is returned and NullPointerException is thrown in case of FreeType errors.
Parameters: pFnt - XftFont handle Parameters: c - specified char |
getItalicAngleNative | native public static synchronized float getItalicAngleNative(long hndFont, int fontType)(Code) | | Returns tangent of Italic angle of given Font.
Returned value is null and NullPointerException is thrown if there is Xft error.
Parameters: hndFont - XftFont handle Parameters: fontType - type of the font |
getNativeLineMetrics | native public static synchronized float[] getNativeLineMetrics(long hFont, int fontSize, boolean isAntialiased, boolean usesFractionalMetrics, int fontType)(Code) | | Returns array of values of font metrics corresponding to the given XftFont
font object. NullPointerException is thrown in case errors in native code.
Parameters: hFont - XftFont handle Parameters: fontSize - size of the font Parameters: isAntialiased - parameter true if antialiased metrics required Parameters: usesFractionalMetrics - true if results calculated using fractional metrics Parameters: fontType - type of the specified font |
getNumGlyphsNative | native public static synchronized int getNumGlyphsNative(long hndFont)(Code) | | Returns number of glyphs in specified XftFont if success.
Parameters: hndFont - XftFont handle |
getPointsFromFTVector | native public static synchronized float[] getPointsFromFTVector(long ft_vector, int size)(Code) | | Returns an array of pairs of coordinates [x1, y1, x2, y2...] from
FreeType FT_Vector structure.
Parameters: ft_vector - pointer to the memory block with FT_Vector structure Parameters: size - number of elements in FT_Vector structure |
initFace | public static void initFace(int index, String faceString)(Code) | | Initializes specified elements with index specified of famIndices, styles and
faces arrays according to the given faceString. faceString has format
"family name"-"style name"-style.
Parameters: index - index of element to identify Parameters: faceString - String defining family name, style name and style in special format |
initFaces | public static void initFaces()(Code) | | Initializes famIndices, styles, style names and faces arrays
according to the font information available on the system.
|
initLCIDsTable | public static void initLCIDsTable(Hashtable ht)(Code) | | Initializes LCID table
|
initializeFont | native public static synchronized long initializeFont(LinuxFont linFont, String family, int style, int size, String styleName)(Code) | | Initiailzes native Xft font object from specified parameters and returns
font handle, also sets font type to the font peer parameter.
NullPointerException is thrown if there are errors in native code.
Parameters: linFont - LinuxFont instance Parameters: family - font family name Parameters: style - style of the font Parameters: size - size of the font Parameters: styleName - style name of the font |
loadLibrary | static void loadLibrary()(Code) | | |
pFontFree | native public static synchronized void pFontFree(long hndFont, long display)(Code) | | Disposing XftFont object.
Parameters: hndFont - XftFont handle Parameters: display - Display handle |
xftDrawSetSubwindowModeNative | native public static void xftDrawSetSubwindowModeNative(long xftDraw, int mode)(Code) | | Set new subwindow mode to XftDraw object
Parameters: xftDraw - XftDraw handle Parameters: mode - new mode |
|
|