Class Os2
- java.lang.Object
-
- com.adobe.fontengine.font.opentype.Table
-
- com.adobe.fontengine.font.opentype.Os2
-
public final class Os2 extends Table
Gives access to the 'OS/2' table.Version handling
'OS/2' tables have only a minor version number. This implementation:
- fully supports version 0, 1, 2 and 3 tables,
- interprets version x > 3 tables as version 3 tables,
When some data is not present in the actual version of the table, the accessors return identified values.
Synchronization
Like all tables, these objects are immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Os2.CodePage
Identifies a code page.static interface
Os2.SelectionBits
static class
Os2.UnicodeRange
Identifies a Unicode range.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCapHeight()
Get the sCapHeight.EmbeddingPermission.OutlineRestriction
getEmbeddingOutlineRestriction()
Get the outline restriction for embedding, using the constants inEmbeddingPermission
.Permission
getEmbeddingPermission()
Get the embedding permission for the font, using the constants inEmbeddingPermission
.EmbeddingPermission.SubsettingRestriction
getEmbeddingSubsettingRestriction()
Get the subsetting restriction for embedding, using the constants inEmbeddingPermission
.int
getFirstChar()
int
getLastChar()
LineMetrics
getLineMetrics()
Return the line metrics for this font.int
getSelection()
Get the fsSelection of this table.int
getTableVersion()
Get the version of this table.int
getTypoAscender()
Get the sTypoAscender of this table.int
getTypoDescender()
Get the sTypoDescender of this table.int
getTypoLineGap()
Get the sTypoLineGap of this table.long
getVendor()
Get the vendor.int
getWeightClass()
Get the usWeight of this table.int
getWidthClass()
Get the usWidth of this table.int
getWinAscent()
Get the usWinAscent of this table.int
getWinDescent()
Get the usWinDescent of this table.int
getxHeight()
Get the sxHeight.int
panoseIndicatesProportional()
void
stream(java.util.Map tables)
void
subsetAndStream(Subset subset, java.util.Map tables)
boolean
supportsCodePage(Os2.CodePage cp)
Determine if a code page is supported.boolean
supportsUnicodeRange(Os2.UnicodeRange cp)
Determine if a Unicode range is supported.
-
-
-
Method Detail
-
getTableVersion
public int getTableVersion() throws InvalidFontException
Get the version of this table.- Throws:
InvalidFontException
-
getWeightClass
public int getWeightClass() throws InvalidFontException
Get the usWeight of this table.- Throws:
InvalidFontException
-
getWidthClass
public int getWidthClass() throws InvalidFontException
Get the usWidth of this table.- Throws:
InvalidFontException
-
panoseIndicatesProportional
public int panoseIndicatesProportional() throws InvalidFontException
- Returns:
- 0 if panose indicates the font is fixed pitch; 1 if it indicates proportional; -1 if don't know
- Throws:
InvalidFontException
-
getSelection
public int getSelection() throws InvalidFontException
Get the fsSelection of this table.- Throws:
InvalidFontException
-
getFirstChar
public int getFirstChar() throws InvalidFontException
- Throws:
InvalidFontException
-
getLastChar
public int getLastChar() throws InvalidFontException
- Throws:
InvalidFontException
-
getTypoAscender
public int getTypoAscender() throws InvalidFontException
Get the sTypoAscender of this table.- Throws:
InvalidFontException
-
getTypoDescender
public int getTypoDescender() throws InvalidFontException
Get the sTypoDescender of this table.- Throws:
InvalidFontException
-
getTypoLineGap
public int getTypoLineGap() throws InvalidFontException
Get the sTypoLineGap of this table.- Throws:
InvalidFontException
-
getWinAscent
public int getWinAscent() throws InvalidFontException
Get the usWinAscent of this table.- Throws:
InvalidFontException
-
getWinDescent
public int getWinDescent() throws InvalidFontException
Get the usWinDescent of this table.- Throws:
InvalidFontException
-
getLineMetrics
public LineMetrics getLineMetrics() throws UnsupportedFontException, InvalidFontException
Return the line metrics for this font. The metrics are expressed in the design space of the font, i.e. they need to be converted through the metrics matrix. Some font formats do not support the notion of line metrics, and in those cases, this method returns null.
-
getVendor
public long getVendor() throws InvalidFontException
Get the vendor.- Throws:
InvalidFontException
-
getxHeight
public int getxHeight() throws InvalidFontException
Get the sxHeight.- Returns:
- the value of the sCapHeight field if present, Integer.MAX_VALUE otherwise.
- Throws:
InvalidFontException
-
getCapHeight
public int getCapHeight() throws InvalidFontException
Get the sCapHeight.- Returns:
- the value of the sCapHeight field if present, Integer.MAX_VALUE otherwise.
- Throws:
InvalidFontException
-
supportsUnicodeRange
public boolean supportsUnicodeRange(Os2.UnicodeRange cp) throws InvalidFontException
Determine if a Unicode range is supported. For some ranges, some versions of the OS/2 table do not expressed whether it is supported.- Returns:
- true iff the Unicode range is expressed and is supported.
- Throws:
InvalidFontException
-
supportsCodePage
public boolean supportsCodePage(Os2.CodePage cp) throws InvalidFontException
Determine if a code page is supported. For some code pages, some versions of the OS/2 table do not expressed whether it is supported.- Returns:
- true iff the code page is expressed and is supported.
- Throws:
InvalidFontException
-
getEmbeddingPermission
public Permission getEmbeddingPermission() throws InvalidFontException
Get the embedding permission for the font, using the constants inEmbeddingPermission
.- Returns:
- one of RESTRICTED, PREVIEW_AND_PRINT, EDITABLE, INSTALLABLE or ILLEGAL_VALUE
- Throws:
InvalidFontException
-
getEmbeddingSubsettingRestriction
public EmbeddingPermission.SubsettingRestriction getEmbeddingSubsettingRestriction() throws InvalidFontException
Get the subsetting restriction for embedding, using the constants inEmbeddingPermission
.- Returns:
- one of FULL_FONT_ONLY, SUBSETTING_OK or UNKNOWN_SUBSETTING_RESTRICTION
- Throws:
InvalidFontException
-
getEmbeddingOutlineRestriction
public EmbeddingPermission.OutlineRestriction getEmbeddingOutlineRestriction() throws InvalidFontException
Get the outline restriction for embedding, using the constants inEmbeddingPermission
.- Returns:
- one of BITMAP_ONLY, OUTLINES_OK or UNKNOWN_OUTLINE_RESTRICTION
- Throws:
InvalidFontException
-
subsetAndStream
public void subsetAndStream(Subset subset, java.util.Map tables)
-
stream
public void stream(java.util.Map tables)
-
-