本文整理汇总了Java中java.awt.font.NumericShaper.shape方法的典型用法代码示例。如果您正苦于以下问题:Java NumericShaper.shape方法的具体用法?Java NumericShaper.shape怎么用?Java NumericShaper.shape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.font.NumericShaper
的用法示例。
在下文中一共展示了NumericShaper.shape方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paragraphInit
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
/**
* Initialize the paragraph-specific data.
*/
private void paragraphInit(byte aBaseline, CoreMetrics lm,
Map<? extends Attribute, ?> paragraphAttrs,
char[] text) {
baseline = aBaseline;
// normalize to current baseline
baselineOffsets = TextLine.getNormalizedOffsets(lm.baselineOffsets, baseline);
justifyRatio = AttributeValues.getJustification(paragraphAttrs);
NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs);
if (shaper != null) {
shaper.shape(text, 0, text.length);
}
}
示例2: checkResult
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
private static void checkResult(String ranges, NumericShaper ns,
String given, String expected) {
char[] text = given.toCharArray();
ns.shape(text, 0, text.length);
String got = new String(text);
if (!expected.equals(got)) {
err = true;
System.err.println("Error with range(s) <" + ranges + ">.");
System.err.println(" text = " + given);
System.err.println(" got = " + got);
System.err.println(" expected = " + expected);
} else {
System.out.println("OK with range(s) <" + ranges + ">.");
System.out.println(" text = " + given);
System.out.println(" got = " + got);
System.out.println(" expected = " + expected);
}
}
示例3: test6943963
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
private static void test6943963() {
// Needed to reproduce this bug.
NumericShaper ns_dummy = getContextualShaper(ARABIC | TAMIL | ETHIOPIC,
EUROPEAN);
char[] c = "\u1200 1".toCharArray();
ns_dummy.shape(c, 0, c.length);
String given = "\u0627\u0628 456";
String expected_ARABIC = "\u0627\u0628 \u0664\u0665\u0666";
String expected_EASTERN_ARABIC = "\u0627\u0628 \u06f4\u06f5\u06f6";
NumericShaper ns = getContextualShaper(ARABIC);
checkResult("ARABIC", ns, given, expected_ARABIC);
ns = getContextualShaper(EnumSet.of(Range.ARABIC));
checkResult("Range.ARABIC", ns, given, expected_ARABIC);
ns = getContextualShaper(EASTERN_ARABIC);
checkResult("EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC);
ns = getContextualShaper(EnumSet.of(Range.EASTERN_ARABIC));
checkResult("Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC);
ns = getContextualShaper(ARABIC | EASTERN_ARABIC);
checkResult("ARABIC | EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC);
ns = getContextualShaper(EnumSet.of(Range.ARABIC, Range.EASTERN_ARABIC));
checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC);
}
示例4: paragraphInit
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
/**
* Initialize the paragraph-specific data.
*/
private void paragraphInit(byte aBaseline, CoreMetrics lm, Map paragraphAttrs, char[] text) {
baseline = aBaseline;
// normalize to current baseline
baselineOffsets = TextLine.getNormalizedOffsets(lm.baselineOffsets, baseline);
justifyRatio = AttributeValues.getJustification(paragraphAttrs);
NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs);
if (shaper != null) {
shaper.shape(text, 0, text.length);
}
}
示例5: paragraphInit
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
/**
* Initialize the paragraph-specific data.
*/
private void paragraphInit(byte aBaseline, CoreMetrics lm, Map paragraphAttrs, char[] text) {
baseline = aBaseline;
// normalize to current baseline
baselineOffsets = TextLine.getNormalizedOffsets(lm.baselineOffsets, baseline);
justifyRatio = AttributeValues.getJustification(paragraphAttrs);
NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs);
if (shaper != null) {
shaper.shape(text, 0, text.length);
}
}
示例6: format
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
/**
* Format.
*
* @param str
* String
* @return String
*/
public static String format(final String str) {
final NumericShaper shaper = NumericShaper.getContextualShaper(NumericShaper.ARABIC);
final char[] c = str.toCharArray();
shaper.shape(c, 0, c.length, NumericShaper.ARABIC);
return new String(c);
}