java getfontname_Java JRStyle.getFontName方法代码示例

这段代码主要用于设置 Barcode4jComponent 的样式属性,包括字体名称、大小、模块宽度、文本位置、静区尺寸等,并使用 UnitConv 进行点到毫米的单位转换。此外,根据组件元素的高度或宽度计算条形码高度。
摘要由CSDN通过智能技术生成

import net.sf.jasperreports.engine.JRStyle; //导入方法依赖的package包/类

protected void setBaseAttributes(Barcode4jComponent barcodeComponent)

{

JRStyle style = getElementStyle();

if (style != null)

{

String fontName = style.getFontName();

if (fontName != null)

{

barcodeBean.setFontName(fontName);

}

Float fontSize = style.getFontsize();

if (fontSize != null)

{

double barFontSize = UnitConv.pt2mm(fontSize.floatValue());

barcodeBean.setFontSize(barFontSize);

}

}

Double moduleWidth = barcodeComponent.getModuleWidth();

if (moduleWidth != null)

{

barcodeBean.setModuleWidth(UnitConv.pt2mm(moduleWidth.doubleValue()));

}

TextPositionEnum textPlacement = barcodeComponent.getTextPositionValue();

if (textPlacement != null)

{

barcodeBean.setMsgPosition(

HumanReadablePlacement.byName(textPlacement.getName()));

}

Double quietZone = barcodeComponent.getQuietZone();

if (quietZone != null)

{

barcodeBean.doQuietZone(true);

barcodeBean.setQuietZone(UnitConv.pt2mm(quietZone.doubleValue()));

}

Double vQuietZone = barcodeComponent.getVerticalQuietZone();

if (vQuietZone != null)

{

barcodeBean.setVerticalQuietZone(UnitConv.pt2mm(vQuietZone.doubleValue()));

}

// FIXME DataMatrix?

double barcodeHeight;

if (BarcodeUtils.isVertical(barcodeComponent))

{

barcodeHeight = UnitConv.pt2mm(componentElement.getWidth());

}

else

{

barcodeHeight = UnitConv.pt2mm(componentElement.getHeight());

}

barcodeBean.setHeight(barcodeHeight);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值