Record Class GlyphMetrics
java.lang.Object
java.lang.Record
cloud.opencode.base.image.codec.font.GlyphMetrics
- Record Components:
advanceWidth- horizontal advance in pixels | 水平 advance(像素)leftSideBearing- left side bearing in pixels | 左侧 bearing(像素)x0- bbox left (inclusive) | 包围盒左(含)y0- bbox top (inclusive, often negative) | 包围盒上 (含,常为负)x1- bbox right (exclusive) | 包围盒右(不含)y1- bbox bottom (exclusive) | 包围盒下(不含)
public record GlyphMetrics(int advanceWidth, int leftSideBearing, int x0, int y0, int x1, int y1)
extends Record
Pixel-space metrics for a single glyph (codepoint) at a specific pixel
height.
给定像素高度下,单个字形(codepoint)的像素空间度量。
advanceWidth and leftSideBearing are in pixels at the
requested font size. The bounding box (x0, y0) (top-left,
inclusive) and (x1, y1) (bottom-right, exclusive) is in image-space
pixels with y growing downward; coordinates are relative to the pen
position (the baseline x and y) — i.e. y0 is typically negative
(above baseline) for ascending glyphs.
advanceWidth 与 leftSideBearing 为请求字号下的像素。
包围盒 (x0, y0)(左上,含)与 (x1, y1)(右下,不含)位于图像
空间像素中,y 向下增长;坐标相对于笔位(基线 x 与 y)— 例如对升部字形
y0 通常为负(基线以上)。
Security | 安全性:
- Thread-safe: Yes - immutable record. - 线程安全: 是 — 不可变 record。
- Since:
- JDK 25, opencode-base-image-codec V1.0.4
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGlyphMetrics(int advanceWidth, int leftSideBearing, int x0, int y0, int x1, int y1) Creates an instance of aGlyphMetricsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theadvanceWidthrecord component.final booleanIndicates whether some other object is "equal to" this one.intGlyph bbox height in pixels.intGlyph bbox width in pixels.final inthashCode()Returns a hash code value for this object.intReturns the value of theleftSideBearingrecord component.final StringtoString()Returns a string representation of this record class.intx0()Returns the value of thex0record component.intx1()Returns the value of thex1record component.inty0()Returns the value of they0record component.inty1()Returns the value of they1record component.
-
Constructor Details
-
GlyphMetrics
public GlyphMetrics(int advanceWidth, int leftSideBearing, int x0, int y0, int x1, int y1) Creates an instance of aGlyphMetricsrecord class.- Parameters:
advanceWidth- the value for theadvanceWidthrecord componentleftSideBearing- the value for theleftSideBearingrecord componentx0- the value for thex0record componenty0- the value for they0record componentx1- the value for thex1record componenty1- the value for they1record component
-
-
Method Details
-
glyphWidth
public int glyphWidth()Glyph bbox width in pixels. 字形包围盒像素宽。- Returns:
x1 - x0|x1 - x0
-
glyphHeight
public int glyphHeight()Glyph bbox height in pixels. 字形包围盒像素高。- Returns:
y1 - y0|y1 - y0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
advanceWidth
public int advanceWidth()Returns the value of theadvanceWidthrecord component.- Returns:
- the value of the
advanceWidthrecord component
-
leftSideBearing
public int leftSideBearing()Returns the value of theleftSideBearingrecord component.- Returns:
- the value of the
leftSideBearingrecord component
-
x0
-
y0
-
x1
-
y1
-