org.lwjgl.nanovg.NanoVG.nnvgTextBreakLines()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.lwjgl.nanovg.NanoVG.nnvgTextBreakLines()方法的一些代码示例,展示了NanoVG.nnvgTextBreakLines()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NanoVG.nnvgTextBreakLines()方法的具体详情如下:
包路径:org.lwjgl.nanovg.NanoVG
类名称:NanoVG
方法名:nnvgTextBreakLines

NanoVG.nnvgTextBreakLines介绍

[英]Unsafe version of: #nvgTextBreakLines
[中]不安全版本:#nvgTextBreakLines

代码示例

代码示例来源:origin: org.lwjgl/lwjgl-nanovg

/**
 * Breaks the specified text into lines. If {@code end} is specified only the sub-string will be used.
 * 
 * <p>White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer
 * than the max width are slit at nearest character (i.e. no hyphenation).</p>
 *
 * @param ctx           the NanoVG context
 * @param string        the text string to measure
 * @param breakRowWidth the maximum row width
 * @param rows          returns the text rows
 */
public static int nvgTextBreakLines(@NativeType("NVGcontext *") long ctx, @NativeType("char const *") ByteBuffer string, float breakRowWidth, @NativeType("NVGtextRow *") NVGTextRow.Buffer rows) {
  if (CHECKS) {
    check(ctx);
  }
  return nnvgTextBreakLines(ctx, memAddress(string), memAddress(string) + string.remaining(), breakRowWidth, rows.address(), rows.remaining());
}

代码示例来源:origin: org.lwjgl/lwjgl-nanovg

/**
 * Breaks the specified text into lines. If {@code end} is specified only the sub-string will be used.
 * 
 * <p>White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer
 * than the max width are slit at nearest character (i.e. no hyphenation).</p>
 *
 * @param ctx           the NanoVG context
 * @param string        the text string to measure
 * @param breakRowWidth the maximum row width
 * @param rows          returns the text rows
 */
public static int nvgTextBreakLines(@NativeType("NVGcontext *") long ctx, @NativeType("char const *") CharSequence string, float breakRowWidth, @NativeType("NVGtextRow *") NVGTextRow.Buffer rows) {
  if (CHECKS) {
    check(ctx);
  }
  MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
  try {
    int stringEncodedLength = stack.nUTF8(string, false);
    long stringEncoded = stack.getPointerAddress();
    return nnvgTextBreakLines(ctx, stringEncoded, stringEncoded + stringEncodedLength, breakRowWidth, rows.address(), rows.remaining());
  } finally {
    stack.setPointer(stackPointer);
  }
}

代码示例来源:origin: SpinyOwl/legui

while (nnvgTextBreakLines(nanovg, start, end, size.x, memAddress(buffer), 1) != 0) {
  NVGTextRow row = buffer.get(0);
  float[] bounds = createBounds(x, y + rows * fontSize, w, h, horizontalAlign, verticalAlign, row.width(), fontSize);

代码示例来源:origin: SpinyOwl/legui

if (hideOverflow) {
  try (NVGTextRow.Buffer buffer = NVGTextRow.calloc(1)) {
    int rows = nnvgTextBreakLines(nvg, startPointer, endPointer, rect.z(), memAddress(buffer), 1);
    if (rows != 0) {
      NVGTextRow row = buffer.get(0);

相关文章