---
title: "点阵输出字符"
author: "jslfl"
date: "2013-02-06T13:38:22Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2013-02-06T13:38:22Z"
id: 1796869
url: "https://jslfl.iteye.com/blog/1796869"
---

http://www.oschina.net/code/snippet_113917_4627

import java.awt.Font;
import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;

public class Test
{
	public static void main(String args)
	{
		try
		{
			Font font = new Font("黑体", Font.PLAIN, 30);
			AffineTransform at = new AffineTransform();
			FontRenderContext frc = new FontRenderContext(at, true, true);
			GlyphVector gv = font.createGlyphVector(frc, "JinCeon"); // 要显示的文字
			Shape shape = gv.getOutline(5, 30);
			int weith = 200;
			int height = 40;
			boolean view = new boolean;
			for (int i = 0; i < weith; i++)
			{
				for (int j = 0; j < height; j++)
				{
					if (shape.contains(i, j))
					{
						view* = true;
					} else
					{
						view* = false;
					}
				}
			}
			for (int j = 0; j < height; j++)
			{
				for (int i = 0; i < weith; i++)
				{
					if (view*)
					{
						System.out.print("@");// 替换成你喜欢的图案
					} else
					{
						System.out.print(" ");
					}
				}
				System.out.println();
			}
		} catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}