Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
501 captures
16 May 2007 - 27 Nov 2024
AprMAYAug
Previous capture28Next capture
202120222023
success
fail
COLLECTED BY
Collection:Common Crawl
Web crawl data from Common Crawl.
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20220528134129/https://openjdk.java.net/projects/font-scaler/

OpenJDK: Font Scaler Replacement Project

At this time, the project is essentially complete, asfreetype has been implemented as a replacement. Soon we will removethis project and transfer bugs and improvements into the scope ofthe 2D group.

Java 2D incorporates technology that converts scalable outlinefonts to a specified size and fits this outline to a pixel grid toproduce a raster for subsequent blitting. Hence the terms fontscaling and rasterization.

The goal of thisproject is to create anopen source JDK text rasterization subsystem. The existingimplementation was licensed by Sun from a 3rd party and can not bereleased as open source.

This project is of a temporary nature and will be open until allmajor objectives are accomplished.

Background

The current font rasteriser is a native library licensed for use byJava 2D. The rasterizer works with Truetype and Type1 font formats,providing a means to obtain bitmap, outline and metrics for aparticular glyph in the particular rasterization mode. Supportedrasterization modes are: black&white, greyscale antialiasing,and subpixel antialiasing. The raterizer is also capable ofperforming arbitrary affine transforms and applying style tooutlines (e.g. bolding or italicizing). The proprietaryimplementation fully supports Truetype hinting and limited Type1hinting.

The rasterizer module has tight connections with several othermodules. In particular:

font management subsystem
Provides higher level API on top of rasterizer (i.e. rasterizerinterface is almost entirely defined by the needs of thissubsystem). Triggers creation of native state and keeps pointers tonative state in the java objects.
This also includes infrastructure such as bitmap caching andcommunication to the "blitting" code.
 
text layout engine
Directly uses rasterizer on the native layer to access sometruetype tables fromt the font file. Note that this is independentfrom rasterization of a glyph.
 
java2d disposer
This is an internal mechanism for disposing of graphics-relatedresources used by Java2D. The rasterizer relies on it to ensurethat native resources are properly released.
The current implementation has better support for Truetype in thejava layer. In particular, mapping from char codes to glyphs isperformed without access to the native library. For Type1 fontssome additional work is delegated to the native rasterizer library.

Note, that input data is not necessarily valid or well-formedand problems can be hard to detect beforehand. Given that therasterizer is largely native code, unexpected problems often leadsto a crash. Robustness is one of the important requirements, andthe current implementation is addresing it on several differentlevels:

Requirements and objectives

The main objectives are:Requirements for solution:Also, it is desired to minimize the import of 3rd party code intothe OpenJDK workspace, i.e. link with external binary library(without any modification to this library).

Overall, we are trying to refactor the logic of working withproprietary code in the way which simplifies plugging anotherimplementation of the font rasterizer instead. But we want tominimize changes to other subsystems to avoid risk of introducingincompatibilities.

Approach

We identifiedfreetype as themost viable cross-platform alternative. It supports the requiredfont formats and rasterization modes. Moreover, it is already usedby the native desktops on Linux and OpenSolaris.

Technically, the native part of rasterizer-related code is splitbetween fontmanager and rasterizer specific library (t2k forproprietary rasterizer). As part of refactoring we separated JNIcalls to the rasterizer-specific and shared parts. Most of therasterizer-specific calls will are performed through implementationof the newly added FontScaler interface.

Note that there are some caveats. In particular, the native textlayout engine needs to obtain pointers to certain truetype tables.(There is no need to process these tables. The contract is toreturn the pointer to the table in the truetype format.)

The current implementation is based on two notions - FontScalerand FontStrike. FontScaler is specific to particular physical fontfile (or data stream). FontStrike is specific to not just the fontfile but also to a particular size, style and rasterization mode.There could be more than one strike per same scaler.

This additional context is available (as native object) on everycall to the rasterizer library and it is used to set parametersbefore processing particular request.

We expect that any scaler implementation will handle errorsinternally. It should throw an exception if the font (i.e. scaler)becomes unusable and make sure native resources are released.

The solution is to use freetype as a separate binary library(and probably use freetype library installed on the platform (ifavailable)). So, hopefully there will be only a fewfreetype-specific files in the OpenJDK workspace (native glue codeand java wrapper (implementation of FontScaler)).

Issues

We do not expect freetype to be identical in behaviour to theexisting rasterizer, Eg,
  1. glyph images may differ
  2. metrics may differ
  3. set of displayable glyphs may differ
It is likely that resolving some of these may require changes inthe freetype library. Also, freetype's API is not frozen andtherefore different library versions might be incompatible. Havingsaid that, these differences are expected to be small insignificance, and few in number.

Status

At this time, the project is essentially complete, asfreetype has been implemented as a replacement. Soon we will removethis project and transfer bugs and improvements into the scope ofthe 2D group.

How to contribute?

You can help by:

Note that this project usesOpenJDKcontribution rules. Please see them for further details.

Community

OpenJDK logo
Installing
Contributing
Sponsoring
Developers' Guide
Vulnerabilities
JDK GA/EA Builds
Mailing lists
Wiki ·IRC
Bylaws ·Census
Legal
JEP Process
Source code
Mercurial
GitHub
Tools
Mercurial
Git
jtreg harness
Groups
(overview)
Adoption
Build
Client Libraries
Compatibility & Specification Review
Compiler
Conformance
Core Libraries
Governing Board
HotSpot
IDE Tooling & Support
Internationalization
JMX
Members
Networking
Porters
Quality
Security
Serviceability
Vulnerability
Web
Projects
(overview)
Amber
Annotations Pipeline 2.0
Audio Engine
Build Infrastructure
CRaC
Caciocavallo
Closures
Code Tools
Coin
Common VM Interface
Compiler Grammar
Detroit
Developers' Guide
Device I/O
Duke
Font Scaler
Framebuffer Toolkit
Graal
Graphics Rasterizer
HarfBuzz Integration
IcedTea
JDK 6
JDK 7
JDK 7 Updates
JDK 8
JDK 8 Updates
JDK 9
JDK (…17,18,19)
JDK Updates
JavaDoc.Next
Jigsaw
Kona
Kulla
Lambda
Lanai
Leyden
Lilliput
Locale Enhancement
Loom
Memory Model Update
Metropolis
Mission Control
Modules
Multi-Language VM
Nashorn
New I/O
OpenJFX
Panama
Penrose
Port: AArch32
Port: AArch64
Port: BSD
Port: Haiku
Port: Mac OS X
Port: MIPS
Port: Mobile
Port: PowerPC/AIX
Port: RISC-V
Port: s390x
Portola
SCTP
Shenandoah
Skara
Sumatra
ThreeTen
Tiered Attribution
Tsan
Type Annotations
XRender Pipeline
Valhalla
Verona
VisualVM
Wakefield
Zero
ZGC
Oracle logo
© 2022 Oracle Corporation and/or its affiliates
Terms of Use · License:GPLv2 ·Privacy ·Trademarks

[8]ページ先頭

©2009-2025 Movatter.jp