您当前的位置: 首页 > 

通过weight权重控制字体的笔画粗细

柳鲲鹏 发布时间:2021-07-28 07:51:53 ,浏览量:0

  这个需要配合泰山JDK8-u292-b273。

package taishan;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.font.TextAttribute;
import java.util.HashMap;

@SuppressWarnings("serial")
public class WeightFontFrame extends TFrame
{
    private final static String FONT_NAME_DENGXIAN = "等线";
    private final static int    FONT_SIZE          = 54;
    
    private final static float  FONT_WEIGHT_05     = 0.5F;
    private final static float  FONT_WEIGHT_10     = 1.0F;
    private final static float  FONT_WEIGHT_15     = 1.5F;
    private final static float  FONT_WEIGHT_20     = 2.0F;

	private final static char[] TAISHAN = "泰山OFFICE".toCharArray();

	public WeightFontFrame()
	{
	    this.getContentPane().setBackground(Color.WHITE);
	}

	@Override
    public void paint(Graphics g)
    {
		super.paint(g);
		
		float[] weights = new float[] {
				FONT_WEIGHT_05,
				FONT_WEIGHT_10,
				FONT_WEIGHT_15,
				FONT_WEIGHT_20
		};
		
		for (int i=0; i            
关注
打赏
1688896170
查看更多评论
0.0545s