Browse our Products
Aspose.Font for Java 26.2 Release Notes
Improvements and Changes
Glyph Width Updates
Implemented cross-format glyph width update functionality through the unified com.aspose.font.IFontMetrics.setGlyphWidth() API.
This feature allows to modify glyph width in a consistent way regardless of the underlying font format.
Currently supported formats:
- TTF
- CFF (except fonts with stored procedures)
- WOFF / WOFF2
- OpenType(OTF)
- SVG
The following code snippet demonstrates how to set glyph width using the public method IFontMetrics.setGlyphWidth().
Set glyph width using method com.aspose.font.IFontMetrics.setGlyphWidth
import com.aspose.font.*;
// 1. Open a TrueType font from a file
Font font = Font.open(FontType.TTF, "MyFont.ttf");
// 2. Access the public IFontMetrics interface
IFontMetrics metrics = font.getMetrics();
//3. Retrieve a glyph identifier for a character
uint code = 'A';
GlyphId glyphId = font.getEncoding().decodeToGid(code);
//4. Change the glyph width
double newWidth = 600.0; // example width value
metrics.setGlyphWidth(glyphId, newWidth);
//5.Verify the change(optional)
double updatedWidth = metrics.getGlyphWidth(glyphId);
System.out.println("Updated width for glyph '" + (char)code + "': " + updatedWidth);
//5. Save the modified font (if you need to persist the change)
font.save("MyFont_Modified.ttf");
| Key | Summary | Category |
|---|
Public API and Backwards Incompatible Changes
Added APIs
- Method Aspose.Font.IFontMetrics.SetGlyphWidth(Aspose.Font.Glyphs.GlyphId,System.Double)
- Method Aspose.Font.FontMetrics.SetGlyphWidth(Aspose.Font.Glyphs.GlyphId,System.Double)
- Method Aspose.Font.Ttf.TtfFontMetrics.SetGlyphWidth(Aspose.Font.Glyphs.GlyphId,System.Double)
- Method Aspose.Font.Cff.CffFontMetrics.SetGlyphWidth(Aspose.Font.Glyphs.GlyphId,System.Double)
- Method Aspose.Font.Type1.Type1FontMetrics.SetGlyphWidth(Aspose.Font.Glyphs.GlyphId,System.Double)
This release of Aspose.Font for Java is a maintenance release which has been migrated from the latest version of Aspose.Font for .NET. It includes all changes from the equivalent .NET version and further improves the overall stability of the API in terms of functionality.
Got Queries?
If you have any query related to Aspose.Font for Java API, please feel free to write to reach us on Aspose.Font forum. We’ll be glad to assist you with your inquiries.