gpt4 book ai didi

com.koolearn.klibrary.text.model.ZLTextStyleEntry类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:02:28 26 4
gpt4 key购买 nike

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

ZLTextStyleEntry介绍

暂无

代码示例

代码示例来源:origin: ydcx/KooReader

public final int getLength(int featureId, ZLTextMetrics metrics, int fontSize) {
  return compute(myLengths[featureId], metrics, fontSize, featureId);
}

代码示例来源:origin: Jiangzqts/EpubRead

public static int compute(Length length, ZLTextMetrics metrics, int fontSize, int featureId) {
  switch (length.Unit) {
    default:
    case SizeUnit.PIXEL:
      return length.Size;
    case SizeUnit.POINT:
      return length.Size * metrics.DPI / 72;
    case SizeUnit.EM_100:
      return (length.Size * fontSize + 50) / 100;
    case SizeUnit.REM_100:
      return (length.Size * metrics.FontSize + 50) / 100;
    case SizeUnit.EX_100:
      // TODO 0.5 font size => height of x
      return (length.Size * fontSize / 2 + 50) / 100;
    case SizeUnit.PERCENT:
      return (length.Size * fullSize(metrics, fontSize, featureId) + 50) / 100;
  }
}

代码示例来源:origin: ydcx/KooReader

@Override
protected boolean isItalicInternal() {
  switch (myEntry.getFontModifier(FONT_MODIFIER_ITALIC)) {
    case TRUE:
      return true;
    case FALSE:
      return false;
    default:
      return Parent.isItalic();
  }
}
@Override

代码示例来源:origin: ydcx/KooReader

@Override
protected boolean isVerticallyAlignedInternal() {
  if (myEntry.isFeatureSupported(LENGTH_VERTICAL_ALIGN)) {
    return myEntry.hasNonZeroLength(LENGTH_VERTICAL_ALIGN);
  } else if (myEntry.isFeatureSupported(NON_LENGTH_VERTICAL_ALIGN)) {
    switch (myEntry.getVerticalAlignCode()) {
      default:
        return false;
      case 0: // sub
      case 1: // super
        return true;
    }
  } else {
    return false;
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

if (ZLTextStyleEntry.isFeatureSupported(mask, i)) {
    final short size = (short) data[dataOffset++];
    final byte unit = (byte) data[dataOffset++];
    entry.setLength(i, size, unit);
if (ZLTextStyleEntry.isFeatureSupported(mask, ALIGNMENT_TYPE) ||
    ZLTextStyleEntry.isFeatureSupported(mask, NON_LENGTH_VERTICAL_ALIGN)) {
  final short value = (short) data[dataOffset++];
  if (ZLTextStyleEntry.isFeatureSupported(mask, ALIGNMENT_TYPE)) {
    entry.setAlignmentType((byte) (value & 0xFF));
  if (ZLTextStyleEntry.isFeatureSupported(mask, NON_LENGTH_VERTICAL_ALIGN)) {
    entry.setVerticalAlignCode((byte) ((value >> 8) & 0xFF));
if (ZLTextStyleEntry.isFeatureSupported(mask, FONT_FAMILY)) {
  entry.setFontFamilies(myFontManager, (short) data[dataOffset++]);
if (ZLTextStyleEntry.isFeatureSupported(mask, FONT_STYLE_MODIFIER)) {
  final short value = (short) data[dataOffset++];
  entry.setFontModifiers((byte) (value & 0xFF), (byte) ((value >> 8) & 0xFF));

代码示例来源:origin: Jiangzqts/EpubRead

@Override
protected int getSpaceBeforeInternal(ZLTextMetrics metrics, int fontSize) {
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSMarginsOption.getValue()) {
    return Parent.getSpaceBefore(metrics);
  }
  if (!myEntry.isFeatureSupported(LENGTH_SPACE_BEFORE)) {
    return Parent.getSpaceBefore(metrics);
  }
  return myEntry.getLength(LENGTH_SPACE_BEFORE, metrics, fontSize);
}
@Override

代码示例来源:origin: Jiangzqts/EpubRead

@Override
protected int getVerticalAlignInternal(ZLTextMetrics metrics, int fontSize) {
  if (myEntry.isFeatureSupported(LENGTH_VERTICAL_ALIGN)) {
    return myEntry.getLength(LENGTH_VERTICAL_ALIGN, metrics, fontSize);
  } else if (myEntry.isFeatureSupported(NON_LENGTH_VERTICAL_ALIGN)) {
    switch (myEntry.getVerticalAlignCode()) {
      default:
        return Parent.getVerticalAlign(metrics);
      case 0: // sub
        return ZLTextStyleEntry.compute(
          new ZLTextStyleEntry.Length((short)-50, ZLTextStyleEntry.SizeUnit.EM_100),
          metrics, fontSize, LENGTH_VERTICAL_ALIGN
        );
      case 1: // super
        return ZLTextStyleEntry.compute(
          new ZLTextStyleEntry.Length((short)50, ZLTextStyleEntry.SizeUnit.EM_100),
          metrics, fontSize, LENGTH_VERTICAL_ALIGN

代码示例来源:origin: Jiangzqts/EpubRead

@Override
protected int getFontSizeInternal(ZLTextMetrics metrics) {
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSFontSizeOption.getValue()) {
    return Parent.getFontSize(metrics);
  }
  final int baseFontSize = getTreeParent().getFontSize(metrics);
  if (myEntry.isFeatureSupported(FONT_STYLE_MODIFIER)) {
    if (myEntry.getFontModifier(FONT_MODIFIER_INHERIT) == Boolean3.TRUE) {
      return baseFontSize;
    }
    if (myEntry.getFontModifier(FONT_MODIFIER_LARGER) == Boolean3.TRUE) {
      return baseFontSize * 120 / 100;
    }
    if (myEntry.getFontModifier(FONT_MODIFIER_SMALLER) == Boolean3.TRUE) {
      return baseFontSize * 100 / 120;
    }
  }
  if (myEntry.isFeatureSupported(LENGTH_FONT_SIZE)) {
    return myEntry.getLength(LENGTH_FONT_SIZE, metrics, baseFontSize);
  }
  return Parent.getFontSize(metrics);
}

代码示例来源:origin: Jiangzqts/EpubRead

public byte getAlignment() {
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSTextAlignmentOption.getValue()) {
    return Parent.getAlignment();
  }
  return
    myEntry.isFeatureSupported(ALIGNMENT_TYPE)
      ? myEntry.getAlignmentType()
      : Parent.getAlignment();
}

代码示例来源:origin: ydcx/KooReader

@Override
protected List<FontEntry> getFontEntriesInternal() {
  final List<FontEntry> parentEntries = Parent.getFontEntries();
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSFontFamilyOption.getValue()) {
    return parentEntries;
  }
  if (!myEntry.isFeatureSupported(FONT_FAMILY)) {
    return parentEntries;
  }
  final List<FontEntry> entries = myEntry.getFontEntries();
  final int lSize = entries.size();
  if (lSize == 0) {
    return parentEntries;
  }
  final int pSize = parentEntries.size();
  if (pSize > lSize && entries.equals(parentEntries.subList(0, lSize))) {
    return parentEntries;
  }
  final List<FontEntry> allEntries = new ArrayList<FontEntry>(pSize + lSize);
  allEntries.addAll(entries);
  allEntries.addAll(parentEntries);
  return allEntries;
}

代码示例来源:origin: ydcx/KooReader

public final boolean isFeatureSupported(int featureId) {
  return isFeatureSupported(myFeatureMask, featureId);
}

代码示例来源:origin: ydcx/KooReader

if (ZLTextStyleEntry.isFeatureSupported(mask, i)) {
    final short size = (short) data[dataOffset++];
    final byte unit = (byte) data[dataOffset++];
    entry.setLength(i, size, unit);
if (ZLTextStyleEntry.isFeatureSupported(mask, ALIGNMENT_TYPE) ||
    ZLTextStyleEntry.isFeatureSupported(mask, NON_LENGTH_VERTICAL_ALIGN)) {
  final short value = (short) data[dataOffset++];
  if (ZLTextStyleEntry.isFeatureSupported(mask, ALIGNMENT_TYPE)) {
    entry.setAlignmentType((byte) (value & 0xFF));
  if (ZLTextStyleEntry.isFeatureSupported(mask, NON_LENGTH_VERTICAL_ALIGN)) {
    entry.setVerticalAlignCode((byte) ((value >> 8) & 0xFF));
if (ZLTextStyleEntry.isFeatureSupported(mask, FONT_FAMILY)) {
  entry.setFontFamilies(myFontManager, (short) data[dataOffset++]);
if (ZLTextStyleEntry.isFeatureSupported(mask, FONT_STYLE_MODIFIER)) {
  final short value = (short) data[dataOffset++];
  entry.setFontModifiers((byte) (value & 0xFF), (byte) ((value >> 8) & 0xFF));

代码示例来源:origin: ydcx/KooReader

@Override
protected int getFirstLineIndentInternal(ZLTextMetrics metrics, int fontSize) {
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSMarginsOption.getValue()) {
    return Parent.getFirstLineIndent(metrics);
  }
  if (!myEntry.isFeatureSupported(LENGTH_FIRST_LINE_INDENT)) {
    return Parent.getFirstLineIndent(metrics);
  }
  return myEntry.getLength(LENGTH_FIRST_LINE_INDENT, metrics, fontSize);
}
@Override

代码示例来源:origin: ydcx/KooReader

@Override
protected int getVerticalAlignInternal(ZLTextMetrics metrics, int fontSize) {
  if (myEntry.isFeatureSupported(LENGTH_VERTICAL_ALIGN)) {
    return myEntry.getLength(LENGTH_VERTICAL_ALIGN, metrics, fontSize);
  } else if (myEntry.isFeatureSupported(NON_LENGTH_VERTICAL_ALIGN)) {
    switch (myEntry.getVerticalAlignCode()) {
      default:
        return Parent.getVerticalAlign(metrics);
      case 0: // sub
        return ZLTextStyleEntry.compute(
          new ZLTextStyleEntry.Length((short)-50, ZLTextStyleEntry.SizeUnit.EM_100),
          metrics, fontSize, LENGTH_VERTICAL_ALIGN
        );
      case 1: // super
        return ZLTextStyleEntry.compute(
          new ZLTextStyleEntry.Length((short)50, ZLTextStyleEntry.SizeUnit.EM_100),
          metrics, fontSize, LENGTH_VERTICAL_ALIGN

代码示例来源:origin: Jiangzqts/EpubRead

@Override
protected boolean isVerticallyAlignedInternal() {
  if (myEntry.isFeatureSupported(LENGTH_VERTICAL_ALIGN)) {
    return myEntry.hasNonZeroLength(LENGTH_VERTICAL_ALIGN);
  } else if (myEntry.isFeatureSupported(NON_LENGTH_VERTICAL_ALIGN)) {
    switch (myEntry.getVerticalAlignCode()) {
      default:
        return false;
      case 0: // sub
      case 1: // super
        return true;
    }
  } else {
    return false;
  }
}

代码示例来源:origin: ydcx/KooReader

@Override
protected int getFontSizeInternal(ZLTextMetrics metrics) {
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSFontSizeOption.getValue()) {
    return Parent.getFontSize(metrics);
  }
  final int baseFontSize = getTreeParent().getFontSize(metrics);
  if (myEntry.isFeatureSupported(FONT_STYLE_MODIFIER)) {
    if (myEntry.getFontModifier(FONT_MODIFIER_INHERIT) == Boolean3.TRUE) {
      return baseFontSize;
    }
    if (myEntry.getFontModifier(FONT_MODIFIER_LARGER) == Boolean3.TRUE) {
      return baseFontSize * 120 / 100;
    }
    if (myEntry.getFontModifier(FONT_MODIFIER_SMALLER) == Boolean3.TRUE) {
      return baseFontSize * 100 / 120;
    }
  }
  if (myEntry.isFeatureSupported(LENGTH_FONT_SIZE)) {
    return myEntry.getLength(LENGTH_FONT_SIZE, metrics, baseFontSize);
  }
  return Parent.getFontSize(metrics);
}

代码示例来源:origin: ydcx/KooReader

public byte getAlignment() {
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSTextAlignmentOption.getValue()) {
    return Parent.getAlignment();
  }
  return
    myEntry.isFeatureSupported(ALIGNMENT_TYPE)
      ? myEntry.getAlignmentType()
      : Parent.getAlignment();
}

代码示例来源:origin: Jiangzqts/EpubRead

@Override
protected List<FontEntry> getFontEntriesInternal() {
  final List<FontEntry> parentEntries = Parent.getFontEntries();
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSFontFamilyOption.getValue()) {
    return parentEntries;
  }
  if (!myEntry.isFeatureSupported(FONT_FAMILY)) {
    return parentEntries;
  }
  final List<FontEntry> entries = myEntry.getFontEntries();
  final int lSize = entries.size();
  if (lSize == 0) {
    return parentEntries;
  }
  final int pSize = parentEntries.size();
  if (pSize > lSize && entries.equals(parentEntries.subList(0, lSize))) {
    return parentEntries;
  }
  final List<FontEntry> allEntries = new ArrayList<FontEntry>(pSize + lSize);
  allEntries.addAll(entries);
  allEntries.addAll(parentEntries);
  return allEntries;
}

代码示例来源:origin: Jiangzqts/EpubRead

public final boolean isFeatureSupported(int featureId) {
  return isFeatureSupported(myFeatureMask, featureId);
}

代码示例来源:origin: ydcx/KooReader

@Override
protected int getSpaceAfterInternal(ZLTextMetrics metrics, int fontSize) {
  if (myEntry instanceof ZLTextCSSStyleEntry && !BaseStyle.UseCSSMarginsOption.getValue()) {
    return Parent.getSpaceAfter(metrics);
  }
  if (!myEntry.isFeatureSupported(LENGTH_SPACE_AFTER)) {
    return Parent.getSpaceAfter(metrics);
  }
  return myEntry.getLength(LENGTH_SPACE_AFTER, metrics, fontSize);
}
public byte getAlignment() {

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com