Documentation

The Java™ Tutorials
Hide TOC
Working with Text APIs使用文本API
Trail: 2D Graphics

Lesson: Working with Text APIs课程:使用文本API

This lesson introduces you to the concept of working with text API's to apply text rendering capabilities.本课程向您介绍使用文本API应用文本呈现功能的概念。Already in this trail, you have used basic Java 2D text APIs and know how to set a font and position, and how to draw text.在本教程中,您已经使用了基本的Java2D文本API,并且知道如何设置字体和位置,以及如何绘制文本。

This lesson expands on that material to help you develop an understanding of how to use those APIs and moves further into the capabilities of Java 2D text display.本课程将对这些内容进行扩展,以帮助您了解如何使用这些API,并进一步了解Java 2D文本显示的功能。

These topics are discussed in the following sections.以下各节将讨论这些主题。

Physical and Logical Fonts物理和逻辑字体
This section explains how to use the methods of the Font class to determine which fonts are available on your system, to create a Font object, and obtain information about a font family.本节介绍如何使用Font类的方法来确定系统上可用的字体、创建Font对象以及获取有关字体系列的信息。
Measuring Text测量文本
This section explains how to properly measure text by using an instance of the FontMetrics class.本节介绍如何通过使用FontMetrics类的实例正确测量文本。
Advanced Text Display高级文本显示
This section explains how to position and render a paragraph of styled text, display antialiased text, use text attributes to style text, and work with bidirectional text.本节介绍如何定位和呈现已设置样式的文本段落、显示抗锯齿文本、使用文本属性设置文本样式以及使用双向文本。

Previous page: Previous Lesson
Next page: Font Concepts