mirror of https://github.com/axmolengine/axmol.git
Merge pull request #504 from adxeproject/freetype-sdf
Replace SDF implementation with freetype
This commit is contained in:
commit
4b69a84292
|
@ -35,7 +35,7 @@ jobs:
|
|||
|
||||
build-linux:
|
||||
name: build-linux
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TRAVIS_OS_NAME: linux
|
||||
BUILD_TARGET: linux
|
||||
|
|
|
@ -27,10 +27,9 @@ THE SOFTWARE.
|
|||
|
||||
#include "2d/CCFontFreeType.h"
|
||||
|
||||
#include <freetype/ftfntfmt.h>
|
||||
#include "freetype/ftfntfmt.h"
|
||||
|
||||
#include FT_BBOX_H
|
||||
#include "edtaa3func.h"
|
||||
#include "2d/CCFontAtlas.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/ccUTF8.h"
|
||||
|
@ -63,9 +62,9 @@ static std::unordered_map<std::string, DataRef> s_cacheFontData;
|
|||
|
||||
// ------ freetype2 stream parsing support ---
|
||||
static unsigned long ft_stream_read_callback(FT_Stream stream,
|
||||
unsigned long offset,
|
||||
unsigned char* buf,
|
||||
unsigned long size)
|
||||
unsigned long offset,
|
||||
unsigned char* buf,
|
||||
unsigned long size)
|
||||
{
|
||||
auto fd = (FileStream*)stream->descriptor.pointer;
|
||||
if (!fd)
|
||||
|
@ -121,6 +120,10 @@ bool FontFreeType::initFreeType()
|
|||
if (FT_Init_FreeType(&_FTlibrary))
|
||||
return false;
|
||||
|
||||
const FT_Int spread = DistanceMapSpread;
|
||||
FT_Property_Set(_FTlibrary, "sdf", "spread", &spread);
|
||||
FT_Property_Set(_FTlibrary, "bsdf", "spread", &spread);
|
||||
|
||||
_FTInitialized = true;
|
||||
}
|
||||
|
||||
|
@ -175,29 +178,7 @@ bool FontFreeType::createFontObject(const std::string& fontName, float fontSize)
|
|||
// save font name locally
|
||||
_fontName = fontName;
|
||||
|
||||
if (!_streamParsingEnabled)
|
||||
{
|
||||
auto it = s_cacheFontData.find(fontName);
|
||||
if (it != s_cacheFontData.end())
|
||||
{
|
||||
(*it).second.referenceCount += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_cacheFontData[fontName].referenceCount = 1;
|
||||
s_cacheFontData[fontName].data = FileUtils::getInstance()->getDataFromFile(fontName);
|
||||
|
||||
if (s_cacheFontData[fontName].data.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (FT_New_Memory_Face(getFTLibrary(), s_cacheFontData[fontName].data.getBytes(),
|
||||
s_cacheFontData[fontName].data.getSize(), 0, &face))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (_streamParsingEnabled)
|
||||
{
|
||||
auto fullPath = FileUtils::getInstance()->fullPathForFilename(fontName);
|
||||
if (fullPath.empty())
|
||||
|
@ -224,6 +205,28 @@ bool FontFreeType::createFontObject(const std::string& fontName, float fontSize)
|
|||
|
||||
_fontStream = std::move(fts);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = s_cacheFontData.find(fontName);
|
||||
if (it != s_cacheFontData.end())
|
||||
{
|
||||
(*it).second.referenceCount += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_cacheFontData[fontName].referenceCount = 1;
|
||||
s_cacheFontData[fontName].data = FileUtils::getInstance()->getDataFromFile(fontName);
|
||||
|
||||
if (s_cacheFontData[fontName].data.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (FT_New_Memory_Face(getFTLibrary(), s_cacheFontData[fontName].data.getBytes(),
|
||||
s_cacheFontData[fontName].data.getSize(), 0, &face))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FT_Select_Charmap(face, FT_ENCODING_UNICODE))
|
||||
{
|
||||
|
@ -403,12 +406,10 @@ unsigned char* FontFreeType::getGlyphBitmap(uint64_t theChar,
|
|||
|
||||
// @remark: glyph_index=0 means
|
||||
auto glyph_index = FT_Get_Char_Index(_fontRef, static_cast<FT_ULong>(theChar));
|
||||
if (FT_Load_Glyph(_fontRef, glyph_index,
|
||||
_distanceFieldEnabled ? (FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT)
|
||||
: (FT_LOAD_RENDER | FT_LOAD_NO_AUTOHINT)))
|
||||
if (FT_Load_Glyph(_fontRef, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_AUTOHINT))
|
||||
break;
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
|
||||
if (glyph_index == 0)
|
||||
{
|
||||
std::u32string charUTF32(1, theChar);
|
||||
|
@ -421,6 +422,10 @@ unsigned char* FontFreeType::getGlyphBitmap(uint64_t theChar,
|
|||
charUTF8.c_str());
|
||||
}
|
||||
#endif
|
||||
if (_distanceFieldEnabled) {
|
||||
// Require freetype version > 2.11.0, because freetype 2.11.0 sdf has memory access bug, see: https://gitlab.freedesktop.org/freetype/freetype/-/issues/1077
|
||||
FT_Render_Glyph(_fontRef->glyph, FT_Render_Mode::FT_RENDER_MODE_SDF);
|
||||
}
|
||||
|
||||
auto& metrics = _fontRef->glyph->metrics;
|
||||
outRect.origin.x = static_cast<float>(metrics.horiBearingX >> 6);
|
||||
|
@ -573,89 +578,6 @@ unsigned char* FontFreeType::getGlyphBitmapWithOutline(uint64_t theChar, FT_BBox
|
|||
return ret;
|
||||
}
|
||||
|
||||
unsigned char* makeDistanceMap(unsigned char* img, int32_t width, int32_t height)
|
||||
{
|
||||
int32_t pixelAmount = (width + 2 * FontFreeType::DistanceMapSpread) * (height + 2 * FontFreeType::DistanceMapSpread);
|
||||
|
||||
short* xdist = (short*)malloc(pixelAmount * sizeof(short));
|
||||
short* ydist = (short*)malloc(pixelAmount * sizeof(short));
|
||||
double* gx = (double*)calloc(pixelAmount, sizeof(double));
|
||||
double* gy = (double*)calloc(pixelAmount, sizeof(double));
|
||||
double* data = (double*)calloc(pixelAmount, sizeof(double));
|
||||
double* outside = (double*)calloc(pixelAmount, sizeof(double));
|
||||
double* inside = (double*)calloc(pixelAmount, sizeof(double));
|
||||
int32_t i, j;
|
||||
|
||||
// Convert img into double (data) rescale image levels between 0 and 1
|
||||
int32_t outWidth = width + 2 * FontFreeType::DistanceMapSpread;
|
||||
for (i = 0; i < width; ++i)
|
||||
{
|
||||
for (j = 0; j < height; ++j)
|
||||
{
|
||||
data[j * outWidth + FontFreeType::DistanceMapSpread + i] = img[j * width + i] / 255.0;
|
||||
}
|
||||
}
|
||||
|
||||
width += 2 * FontFreeType::DistanceMapSpread;
|
||||
height += 2 * FontFreeType::DistanceMapSpread;
|
||||
|
||||
// Transform background (outside contour, in areas of 0's)
|
||||
computegradient(data, (int)width, (int)height, gx, gy);
|
||||
edtaa3(data, gx, gy, (int)width, (int)height, xdist, ydist, outside);
|
||||
for (i = 0; i < pixelAmount; i++)
|
||||
if (outside[i] < 0.0)
|
||||
outside[i] = 0.0;
|
||||
|
||||
// Transform foreground (inside contour, in areas of 1's)
|
||||
for (i = 0; i < pixelAmount; i++)
|
||||
data[i] = 1 - data[i];
|
||||
computegradient(data, (int)width, (int)height, gx, gy);
|
||||
edtaa3(data, gx, gy, (int)width, (int)height, xdist, ydist, inside);
|
||||
for (i = 0; i < pixelAmount; i++)
|
||||
if (inside[i] < 0.0)
|
||||
inside[i] = 0.0;
|
||||
|
||||
// The bipolar distance field is now outside-inside
|
||||
double dist;
|
||||
/* Single channel 8-bit output (bad precision and range, but simple) */
|
||||
unsigned char* out = (unsigned char*)malloc(pixelAmount * sizeof(unsigned char));
|
||||
for (i = 0; i < pixelAmount; i++)
|
||||
{
|
||||
dist = outside[i] - inside[i];
|
||||
dist = 128.0 - dist * 16;
|
||||
if (dist < 0)
|
||||
dist = 0;
|
||||
if (dist > 255)
|
||||
dist = 255;
|
||||
out[i] = (unsigned char)dist;
|
||||
}
|
||||
/* Dual channel 16-bit output (more complicated, but good precision and range) */
|
||||
/*unsigned char *out = (unsigned char *) malloc( pixelAmount * 3 * sizeof(unsigned char) );
|
||||
for( i=0; i< pixelAmount; i++)
|
||||
{
|
||||
dist = outside[i] - inside[i];
|
||||
dist = 128.0 - dist*16;
|
||||
if( dist < 0.0 ) dist = 0.0;
|
||||
if( dist >= 256.0 ) dist = 255.999;
|
||||
// R channel is a copy of the original grayscale image
|
||||
out[3*i] = img[i];
|
||||
// G channel is fraction
|
||||
out[3*i + 1] = (unsigned char) ( 256 - (dist - floor(dist)* 256.0 ));
|
||||
// B channel is truncated integer part
|
||||
out[3*i + 2] = (unsigned char)dist;
|
||||
}*/
|
||||
|
||||
free(xdist);
|
||||
free(ydist);
|
||||
free(gx);
|
||||
free(gy);
|
||||
free(data);
|
||||
free(outside);
|
||||
free(inside);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void FontFreeType::renderCharAt(unsigned char* dest,
|
||||
int posX,
|
||||
int posY,
|
||||
|
@ -666,38 +588,7 @@ void FontFreeType::renderCharAt(unsigned char* dest,
|
|||
int iX = posX;
|
||||
int iY = posY;
|
||||
|
||||
if (_distanceFieldEnabled)
|
||||
{
|
||||
auto distanceMap = makeDistanceMap(bitmap, bitmapWidth, bitmapHeight);
|
||||
|
||||
bitmapWidth += 2 * DistanceMapSpread;
|
||||
bitmapHeight += 2 * DistanceMapSpread;
|
||||
|
||||
for (int32_t y = 0; y < bitmapHeight; ++y)
|
||||
{
|
||||
int32_t bitmap_y = y * bitmapWidth;
|
||||
|
||||
for (int32_t x = 0; x < bitmapWidth; ++x)
|
||||
{
|
||||
/* Dual channel 16-bit output (more complicated, but good precision and range) */
|
||||
/*int index = (iX + ( iY * destSize )) * 3;
|
||||
int index2 = (bitmap_y + x)*3;
|
||||
dest[index] = out[index2];
|
||||
dest[index + 1] = out[index2 + 1];
|
||||
dest[index + 2] = out[index2 + 2];*/
|
||||
|
||||
// Single channel 8-bit output
|
||||
dest[iX + (iY * FontAtlas::CacheTextureWidth)] = distanceMap[bitmap_y + x];
|
||||
|
||||
iX += 1;
|
||||
}
|
||||
|
||||
iX = posX;
|
||||
iY += 1;
|
||||
}
|
||||
free(distanceMap);
|
||||
}
|
||||
else if (_outlineSize > 0)
|
||||
if (_outlineSize > 0)
|
||||
{
|
||||
unsigned char tempChar;
|
||||
for (int32_t y = 0; y < bitmapHeight; ++y)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "2d/CCFont.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include "ft2build.h"
|
||||
#include <string>
|
||||
|
||||
#include FT_FREETYPE_H
|
||||
|
|
|
@ -37,3 +37,14 @@ DEPENDS+=' libasound2-dev'
|
|||
DEPENDS+=' libxxf86vm-dev'
|
||||
|
||||
sudo apt-get install --allow-unauthenticated --yes $DEPENDS > /dev/null
|
||||
|
||||
echo "Installing latest freetype for linux ..."
|
||||
mkdir buildsrc
|
||||
cd buildsrc
|
||||
git clone https://gitlab.freedesktop.org/freetype/freetype.git
|
||||
cd freetype
|
||||
sh autogen.sh
|
||||
./configure --prefix=/usr --enable-freetype-config --disable-static
|
||||
sudo make install
|
||||
cd ..
|
||||
cd ..
|
||||
|
|
|
@ -18,7 +18,6 @@ option(BUILD_DEP_OPENSSL "Build with internal openssl support" ON)
|
|||
option(BUILD_DEP_WEBP "Build with internal webp support" ON)
|
||||
option(BUILD_DEP_PUGIXML "Build with internal pugixml support" ON)
|
||||
option(BUILD_DEP_CLIPPER "Build with internal clipper support" ON)
|
||||
option(BUILD_DEP_EDTAA3FUNC "Build with internal edtaa3func support" ON)
|
||||
option(BUILD_DEP_CONVERTUTF "Build with internal ConvertUTF support" ON)
|
||||
option(BUILD_DEP_POLY2TRI "Build with internal poly2tri support" ON)
|
||||
option(BUILD_DEP_ZLIB "Build with internal zlib support" ON)
|
||||
|
@ -179,11 +178,6 @@ if(BUILD_DEP_CLIPPER)
|
|||
target_link_libraries(thirdparty clipper)
|
||||
configure_target_outdir(clipper)
|
||||
endif(BUILD_DEP_CLIPPER)
|
||||
if(BUILD_DEP_EDTAA3FUNC)
|
||||
add_subdirectory(edtaa3func)
|
||||
target_link_libraries(thirdparty edtaa3func)
|
||||
configure_target_outdir(edtaa3func)
|
||||
endif(BUILD_DEP_EDTAA3FUNC)
|
||||
if(BUILD_DEP_CONVERTUTF)
|
||||
add_subdirectory(ConvertUTF)
|
||||
target_link_libraries(thirdparty ConvertUTF)
|
||||
|
|
|
@ -49,11 +49,6 @@
|
|||
- Version: 7.78.0
|
||||
- License: Curl (MIT/X)
|
||||
|
||||
## edtaa3func
|
||||
- Upstream: https://github.com/zilongshanren/edtaa3func
|
||||
- Version: git d02e47d
|
||||
- License: MIT
|
||||
|
||||
## flatbuffers
|
||||
- Upstream: https://github.com/google/flatbuffers
|
||||
- Version: 2.0.0
|
||||
|
@ -66,7 +61,7 @@
|
|||
|
||||
## FreeType
|
||||
- Upstream: https://www.freetype.org/
|
||||
- Version: 2.11.0
|
||||
- Version: git 52915898 (7255)
|
||||
- License: BSD-style (The FreeType Project)
|
||||
|
||||
## Glad
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
set(lib_name edtaa3func)
|
||||
set(target_name ${lib_name})
|
||||
|
||||
project(${lib_name})
|
||||
|
||||
add_library(${target_name} STATIC
|
||||
edtaa3func.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${target_name} PUBLIC .)
|
||||
|
|
@ -1,582 +0,0 @@
|
|||
/*
|
||||
* edtaa3()
|
||||
*
|
||||
* Sweep-and-update Euclidean distance transform of an
|
||||
* image. Positive pixels are treated as object pixels,
|
||||
* zero or negative pixels are treated as background.
|
||||
* An attempt is made to treat antialiased edges correctly.
|
||||
* The input image must have pixels in the range [0,1],
|
||||
* and the antialiased image should be a box-filter
|
||||
* sampling of the ideal, crisp edge.
|
||||
* If the antialias region is more than 1 pixel wide,
|
||||
* the result from this transform will be inaccurate.
|
||||
*
|
||||
* By Stefan Gustavson (stefan.gustavson@gmail.com).
|
||||
*
|
||||
* Originally written in 1994, based on a verbal
|
||||
* description of Per-Erik Danielsson's SSED8 algorithm
|
||||
* as presented in the PhD dissertation of Ingemar
|
||||
* Ragnemalm. This is Per-Erik Danielsson's scanline
|
||||
* scheme from 1979 - I only implemented it in C.
|
||||
*
|
||||
* Updated in 2004 to treat border pixels correctly,
|
||||
* and cleaned up the code to improve readability.
|
||||
*
|
||||
* Updated in 2009 to handle anti-aliased edges,
|
||||
* as published in the article "Anti-aliased Euclidean
|
||||
* distance transform" by Stefan Gustavson and Robin Strand,
|
||||
* Pattern Recognition Letters 32 (2011) 252¨C257.
|
||||
*
|
||||
* Updated in 2011 to avoid a corner case causing an
|
||||
* infinite loop for some input data.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright (C) 2009 Stefan Gustavson (stefan.gustavson@gmail.com)
|
||||
|
||||
This software is distributed under the permissive "MIT License":
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Compute the local gradient at edge pixels using convolution filters.
|
||||
* The gradient is computed only at edge pixels. At other places in the
|
||||
* image, it is never used, and it's mostly zero anyway.
|
||||
*/
|
||||
void computegradient(double *img, int w, int h, double *gx, double *gy)
|
||||
{
|
||||
int i,j,k;
|
||||
double glength;
|
||||
#define SQRT2 1.4142136
|
||||
for(i = 1; i < h-1; i++) { // Avoid edges where the kernels would spill over
|
||||
for(j = 1; j < w-1; j++) {
|
||||
k = i*w + j;
|
||||
if((img[k]>0.0) && (img[k]<1.0)) { // Compute gradient for edge pixels only
|
||||
gx[k] = -img[k-w-1] - SQRT2*img[k-1] - img[k+w-1] + img[k-w+1] + SQRT2*img[k+1] + img[k+w+1];
|
||||
gy[k] = -img[k-w-1] - SQRT2*img[k-w] - img[k+w-1] + img[k-w+1] + SQRT2*img[k+w] + img[k+w+1];
|
||||
glength = gx[k]*gx[k] + gy[k]*gy[k];
|
||||
if(glength > 0.0) { // Avoid division by zero
|
||||
glength = sqrt(glength);
|
||||
gx[k]=gx[k]/glength;
|
||||
gy[k]=gy[k]/glength;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Compute reasonable values for gx, gy also around the image edges.
|
||||
// (These are zero now, which reduces the accuracy for a 1-pixel wide region
|
||||
// around the image edge.) 2x2 kernels would be suitable for this.
|
||||
}
|
||||
|
||||
/*
|
||||
* A somewhat tricky function to approximate the distance to an edge in a
|
||||
* certain pixel, with consideration to either the local gradient (gx,gy)
|
||||
* or the direction to the pixel (dx,dy) and the pixel greyscale value a.
|
||||
* The latter alternative, using (dx,dy), is the metric used by edtaa2().
|
||||
* Using a local estimate of the edge gradient (gx,gy) yields much better
|
||||
* accuracy at and near edges, and reduces the error even at distant pixels
|
||||
* provided that the gradient direction is accurately estimated.
|
||||
*/
|
||||
double edgedf(double gx, double gy, double a)
|
||||
{
|
||||
double df, glength, temp, a1;
|
||||
|
||||
if ((gx == 0) || (gy == 0)) { // Either A) gu or gv are zero, or B) both
|
||||
df = 0.5-a; // Linear approximation is A) correct or B) a fair guess
|
||||
} else {
|
||||
glength = sqrt(gx*gx + gy*gy);
|
||||
if(glength>0) {
|
||||
gx = gx/glength;
|
||||
gy = gy/glength;
|
||||
}
|
||||
/* Everything is symmetric wrt sign and transposition,
|
||||
* so move to first octant (gx>=0, gy>=0, gx>=gy) to
|
||||
* avoid handling all possible edge directions.
|
||||
*/
|
||||
gx = fabs(gx);
|
||||
gy = fabs(gy);
|
||||
if(gx<gy) {
|
||||
temp = gx;
|
||||
gx = gy;
|
||||
gy = temp;
|
||||
}
|
||||
a1 = 0.5*gy/gx;
|
||||
if (a < a1) { // 0 <= a < a1
|
||||
df = 0.5*(gx + gy) - sqrt(2.0*gx*gy*a);
|
||||
} else if (a < (1.0-a1)) { // a1 <= a <= 1-a1
|
||||
df = (0.5-a)*gx;
|
||||
} else { // 1-a1 < a <= 1
|
||||
df = -0.5*(gx + gy) + sqrt(2.0*gx*gy*(1.0-a));
|
||||
}
|
||||
}
|
||||
return df;
|
||||
}
|
||||
|
||||
double distaa3(double *img, double *gximg, double *gyimg, int w, int c, int xc, int yc, int xi, int yi)
|
||||
{
|
||||
double di, df, dx, dy, gx, gy, a;
|
||||
int closest;
|
||||
|
||||
closest = c-xc-yc*w; // Index to the edge pixel pointed to from c
|
||||
a = img[closest]; // Grayscale value at the edge pixel
|
||||
gx = gximg[closest]; // X gradient component at the edge pixel
|
||||
gy = gyimg[closest]; // Y gradient component at the edge pixel
|
||||
|
||||
if(a > 1.0) a = 1.0;
|
||||
if(a < 0.0) a = 0.0; // Clip grayscale values outside the range [0,1]
|
||||
if(a == 0.0) return 1000000.0; // Not an object pixel, return "very far" ("don't know yet")
|
||||
|
||||
dx = (double)xi;
|
||||
dy = (double)yi;
|
||||
di = sqrt(dx*dx + dy*dy); // Length of integer vector, like a traditional EDT
|
||||
if(di==0) { // Use local gradient only at edges
|
||||
// Estimate based on local gradient only
|
||||
df = edgedf(gx, gy, a);
|
||||
} else {
|
||||
// Estimate gradient based on direction to edge (accurate for large di)
|
||||
df = edgedf(dx, dy, a);
|
||||
}
|
||||
return di + df; // Same metric as edtaa2, except at edges (where di=0)
|
||||
}
|
||||
|
||||
// Shorthand macro: add ubiquitous parameters img, gx, gy and w and call distaa3()
|
||||
#define DISTAA(c,xc,yc,xi,yi) (distaa3(img, gx, gy, w, c, xc, yc, xi, yi))
|
||||
|
||||
void edtaa3(double *img, double *gx, double *gy, int w, int h, short *distx, short *disty, double *dist)
|
||||
{
|
||||
int x, y, i, c;
|
||||
int offset_u, offset_ur, offset_r, offset_rd,
|
||||
offset_d, offset_dl, offset_l, offset_lu;
|
||||
double olddist, newdist;
|
||||
int cdistx, cdisty, newdistx, newdisty;
|
||||
int changed;
|
||||
double epsilon = 1e-3; // Safeguard against errors due to limited precision
|
||||
|
||||
/* Initialize index offsets for the current image width */
|
||||
offset_u = -w;
|
||||
offset_ur = -w+1;
|
||||
offset_r = 1;
|
||||
offset_rd = w+1;
|
||||
offset_d = w;
|
||||
offset_dl = w-1;
|
||||
offset_l = -1;
|
||||
offset_lu = -w-1;
|
||||
|
||||
/* Initialize the distance images */
|
||||
for(i=0; i<w*h; i++) {
|
||||
distx[i] = 0; // At first, all pixels point to
|
||||
disty[i] = 0; // themselves as the closest known.
|
||||
if(img[i] <= 0.0)
|
||||
{
|
||||
dist[i]= 1000000.0; // Big value, means "not set yet"
|
||||
}
|
||||
else if (img[i]<1.0) {
|
||||
dist[i] = edgedf(gx[i], gy[i], img[i]); // Gradient-assisted estimate
|
||||
}
|
||||
else {
|
||||
dist[i]= 0.0; // Inside the object
|
||||
}
|
||||
}
|
||||
|
||||
/* Perform the transformation */
|
||||
do
|
||||
{
|
||||
changed = 0;
|
||||
|
||||
/* Scan rows, except first row */
|
||||
for(y=1; y<h; y++)
|
||||
{
|
||||
|
||||
/* move index to leftmost pixel of current row */
|
||||
i = y*w;
|
||||
|
||||
/* scan right, propagate distances from above & left */
|
||||
|
||||
/* Leftmost pixel is special, has no left neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If non-zero distance or not set yet
|
||||
{
|
||||
c = i + offset_u; // Index of candidate for testing
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_ur;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
|
||||
/* Middle pixels have all neighbors */
|
||||
for(x=1; x<w-1; x++, i++)
|
||||
{
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // No need to update further
|
||||
|
||||
c = i+offset_l;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_lu;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_u;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_ur;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Rightmost pixel of row is special, has no right neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If not already zero distance
|
||||
{
|
||||
c = i+offset_l;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_lu;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_u;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move index to second rightmost pixel of current row. */
|
||||
/* Rightmost pixel is skipped, it has no right neighbor. */
|
||||
i = y*w + w-2;
|
||||
|
||||
/* scan left, propagate distance from right */
|
||||
for(x=w-2; x>=0; x--, i--)
|
||||
{
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // Already zero distance
|
||||
|
||||
c = i+offset_r;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan rows in reverse order, except last row */
|
||||
for(y=h-2; y>=0; y--)
|
||||
{
|
||||
/* move index to rightmost pixel of current row */
|
||||
i = y*w + w-1;
|
||||
|
||||
/* Scan left, propagate distances from below & right */
|
||||
|
||||
/* Rightmost pixel is special, has no right neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If not already zero distance
|
||||
{
|
||||
c = i+offset_d;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_dl;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
i--;
|
||||
|
||||
/* Middle pixels have all neighbors */
|
||||
for(x=w-2; x>0; x--, i--)
|
||||
{
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // Already zero distance
|
||||
|
||||
c = i+offset_r;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_rd;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_d;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_dl;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
/* Leftmost pixel is special, has no left neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If not already zero distance
|
||||
{
|
||||
c = i+offset_r;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_rd;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_d;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move index to second leftmost pixel of current row. */
|
||||
/* Leftmost pixel is skipped, it has no left neighbor. */
|
||||
i = y*w + 1;
|
||||
for(x=1; x<w; x++, i++)
|
||||
{
|
||||
/* scan right, propagate distance from left */
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // Already zero distance
|
||||
|
||||
c = i+offset_l;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(changed); // Sweep until no more updates are made
|
||||
|
||||
/* The transformation is completed. */
|
||||
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2009 Stefan Gustavson (stefan.gustavson@gmail.com)
|
||||
|
||||
This software is distributed under the permissive "MIT License":
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* edtaa3()
|
||||
*
|
||||
* Sweep-and-update Euclidean distance transform of an
|
||||
* image. Positive pixels are treated as object pixels,
|
||||
* zero or negative pixels are treated as background.
|
||||
* An attempt is made to treat antialiased edges correctly.
|
||||
* The input image must have pixels in the range [0,1],
|
||||
* and the antialiased image should be a box-filter
|
||||
* sampling of the ideal, crisp edge.
|
||||
* If the antialias region is more than 1 pixel wide,
|
||||
* the result from this transform will be inaccurate.
|
||||
*
|
||||
* By Stefan Gustavson (stefan.gustavson@gmail.com).
|
||||
*
|
||||
* Originally written in 1994, based on a verbal
|
||||
* description of Per-Erik Danielsson's SSED8 algorithm
|
||||
* as presented in the PhD dissertation of Ingemar
|
||||
* Ragnemalm. This is Per-Erik Danielsson's scanline
|
||||
* scheme from 1979 - I only implemented it in C.
|
||||
*
|
||||
* Updated in 2004 to treat border pixels correctly,
|
||||
* and cleaned up the code to improve readability.
|
||||
*
|
||||
* Updated in 2009 to handle anti-aliased edges,
|
||||
* as published in the article "Anti-aliased Euclidean
|
||||
* distance transform" by Stefan Gustavson and Robin Strand,
|
||||
* Pattern Recognition Letters 32 (2011) 252¨C257.
|
||||
*
|
||||
* Updated in 2011 to avoid a corner case causing an
|
||||
* infinite loop for some input data.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __EDTAA3FUNC_H__
|
||||
#define __EDTAA3FUNC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*
|
||||
* Compute the local gradient at edge pixels using convolution filters.
|
||||
* The gradient is computed only at edge pixels. At other places in the
|
||||
* image, it is never used, and it's mostly zero anyway.
|
||||
*/
|
||||
void computegradient(double *img, int w, int h, double *gx, double *gy);
|
||||
|
||||
/*
|
||||
* A somewhat tricky function to approximate the distance to an edge in a
|
||||
* certain pixel, with consideration to either the local gradient (gx,gy)
|
||||
* or the direction to the pixel (dx,dy) and the pixel greyscale value a.
|
||||
* The latter alternative, using (dx,dy), is the metric used by edtaa2().
|
||||
* Using a local estimate of the edge gradient (gx,gy) yields much better
|
||||
* accuracy at and near edges, and reduces the error even at distant pixels
|
||||
* provided that the gradient direction is accurately estimated.
|
||||
*/
|
||||
double edgedf(double gx, double gy, double a);
|
||||
|
||||
|
||||
double distaa3(double *img, double *gximg, double *gyimg, int w, int c, int xc, int yc, int xi, int yi);
|
||||
|
||||
// Shorthand macro: add ubiquitous parameters dist, gx, gy, img and w and call distaa3()
|
||||
#define DISTAA(c,xc,yc,xi,yi) (distaa3(img, gx, gy, w, c, xc, yc, xi, yi))
|
||||
|
||||
void edtaa3(double *img, double *gx, double *gy, int w, int h, short *distx, short *disty, double *dist);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __EDTAA3FUNC_H__
|
|
@ -12,13 +12,17 @@
|
|||
# fully.
|
||||
#
|
||||
#
|
||||
# The following will 1. create a build directory and 2. change into it and
|
||||
# The following will (1) create a build directory, and (2) change into it and
|
||||
# call cmake to configure the build with default parameters as a static
|
||||
# library. See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
|
||||
# for information about Debug, Release, etc. builds.
|
||||
# library. See
|
||||
#
|
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
|
||||
#
|
||||
# for information about debug or release builds, for example
|
||||
#
|
||||
# cmake -B build -D CMAKE_BUILD_TYPE=Release
|
||||
#
|
||||
#
|
||||
# For a dynamic library, use
|
||||
#
|
||||
# cmake -B build -D BUILD_SHARED_LIBS=true -D CMAKE_BUILD_TYPE=Release
|
||||
|
@ -39,7 +43,8 @@
|
|||
#
|
||||
# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR64 ..
|
||||
#
|
||||
# Finally, build the project with:
|
||||
#
|
||||
# Finally, build the project with
|
||||
#
|
||||
# cmake --build build
|
||||
#
|
||||
|
@ -56,40 +61,47 @@
|
|||
#
|
||||
# Some notes.
|
||||
#
|
||||
# . `cmake' creates configuration files in
|
||||
# - `cmake' creates configuration files in
|
||||
#
|
||||
# <build-directory>/include/freetype/config
|
||||
#
|
||||
# which should be further modified if necessary.
|
||||
#
|
||||
# . You can use `cmake' directly on a freshly cloned FreeType git
|
||||
# - You can use `cmake' directly on a freshly cloned FreeType git
|
||||
# repository.
|
||||
#
|
||||
# . `CMakeLists.txt' is provided as-is since it is normally not used by the
|
||||
# - `CMakeLists.txt' is provided as-is since it is normally not used by the
|
||||
# developer team.
|
||||
#
|
||||
# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG',
|
||||
# `FT_WITH_HARFBUZZ', and `FT_WITH_BROTLI' CMake variables to `ON' to
|
||||
# force using a dependency. Leave a variable undefined (which is the
|
||||
# default) to use the dependency only if it is available. Example:
|
||||
# - Set the `FT_REQUIRE_ZLIB', `FT_REQUIRE_BZIP2', `FT_REQUIRE_PNG',
|
||||
# `FT_REQUIRE_HARFBUZZ', and `FT_REQUIRE_BROTLI' CMake variables to `ON'
|
||||
# or `TRUE' to force using a dependency. Leave a variable undefined
|
||||
# (which is the default) to use the dependency only if it is available.
|
||||
# Example:
|
||||
#
|
||||
# cmake -B build -D FT_WITH_ZLIB=ON \
|
||||
# -D FT_WITH_BZIP2=ON \
|
||||
# -D FT_WITH_PNG=ON \
|
||||
# -D FT_WITH_HARFBUZZ=ON \
|
||||
# -D FT_WITH_BROTLI=ON [...]
|
||||
# cmake -B build -D FT_REQUIRE_ZLIB=TRUE \
|
||||
# -D FT_REQUIRE_BZIP2=TRUE \
|
||||
# -D FT_REQUIRE_PNG=TRUE \
|
||||
# -D FT_REQUIRE_HARFBUZZ=TRUE \
|
||||
# -D FT_REQUIRE_BROTLI=TRUE [...]
|
||||
#
|
||||
# Set `CMAKE_DISABLE_FIND_PACKAGE_XXX=TRUE' to disable a dependency completely
|
||||
# (where `XXX' is a CMake package name like `BZip2'). Example for disabling all
|
||||
# - Set `FT_DISABLE_XXX=TRUE' to disable a dependency completely (where
|
||||
# `XXX' is a CMake package name like `BZip2'). Example for disabling all
|
||||
# dependencies:
|
||||
#
|
||||
# cmake -B build -D CMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE \
|
||||
# -D CMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE \
|
||||
# -D CMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE \
|
||||
# -D CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE \
|
||||
# -D CMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE [...]
|
||||
# cmake -B build -D FT_DISABLE_ZLIB=TRUE \
|
||||
# -D FT_DISABLE_BZIP2=TRUE \
|
||||
# -D FT_DISABLE_PNG=TRUE \
|
||||
# -D FT_DISABLE_HARFBUZZ=TRUE \
|
||||
# -D FT_DISABLE_BROTLI=TRUE [...]
|
||||
#
|
||||
# . Installation of FreeType can be controlled with the CMake variables
|
||||
# - NOTE: If a package is set as DISABLED, it cannot be set as REQUIRED
|
||||
# without unsetting the DISABLED value first. For example, if
|
||||
# `FT_DISABLE_HARFBUZZ=TRUE' has been set (Cache is present), you need to
|
||||
# call `FT_DISABLE_HARFBUZZ=FALSE' before calling
|
||||
# `FT_REQUIRE_HARFBUZZ=TRUE'.
|
||||
#
|
||||
# - Installation of FreeType can be controlled with the CMake variables
|
||||
# `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL'
|
||||
# (this is compatible with the same CMake variables in zlib's CMake
|
||||
# support).
|
||||
|
@ -109,6 +121,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 3.3)
|
|||
endif ()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
# CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which
|
||||
# configures the base build environment and references the toolchain file
|
||||
|
@ -171,13 +184,37 @@ string(REGEX REPLACE
|
|||
math(EXPR LIBRARY_SOVERSION "${LIBTOOL_CURRENT} - ${LIBTOOL_AGE}")
|
||||
set(LIBRARY_VERSION "${LIBRARY_SOVERSION}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}")
|
||||
|
||||
# External dependency library detection is automatic. See the notes at the top
|
||||
# of this file, for how to force or disable dependencies completely.
|
||||
option(FT_WITH_ZLIB "Use system zlib instead of internal library." OFF)
|
||||
option(FT_WITH_BZIP2 "Support bzip2 compressed fonts." OFF)
|
||||
option(FT_WITH_PNG "Support PNG compressed OpenType embedded bitmaps." OFF)
|
||||
option(FT_WITH_HARFBUZZ "Improve auto-hinting of OpenType fonts." OFF)
|
||||
option(FT_WITH_BROTLI "Support compressed WOFF2 fonts." OFF)
|
||||
# External dependency library detection is automatic. See the notes at the
|
||||
# top of this file, for how to force or disable dependencies completely.
|
||||
option(FT_DISABLE_ZLIB
|
||||
"Disable use of system zlib and use internal zlib library instead." OFF)
|
||||
cmake_dependent_option(FT_REQUIRE_ZLIB
|
||||
"Require system zlib instead of internal zlib library." OFF
|
||||
"NOT FT_DISABLE_ZLIB" OFF)
|
||||
|
||||
option(FT_DISABLE_BZIP2
|
||||
"Disable support of bzip2 compressed fonts." OFF)
|
||||
cmake_dependent_option(FT_REQUIRE_BZIP2
|
||||
"Require support of bzip2 compressed fonts." OFF
|
||||
"NOT FT_DISABLE_BZIP2" OFF)
|
||||
|
||||
option(FT_DISABLE_PNG
|
||||
"Disable support of PNG compressed OpenType embedded bitmaps." OFF)
|
||||
cmake_dependent_option(FT_REQUIRE_PNG
|
||||
"Require support of PNG compressed OpenType embedded bitmaps." OFF
|
||||
"NOT FT_DISABLE_PNG" OFF)
|
||||
|
||||
option(FT_DISABLE_HARFBUZZ
|
||||
"Disable HarfBuzz (used for improving auto-hinting of OpenType fonts)." OFF)
|
||||
cmake_dependent_option(FT_REQUIRE_HARFBUZZ
|
||||
"Require HarfBuzz for improving auto-hinting of OpenType fonts." OFF
|
||||
"NOT FT_DISABLE_HARFBUZZ" OFF)
|
||||
|
||||
option(FT_DISABLE_BROTLI
|
||||
"Disable support of compressed WOFF2 fonts." OFF)
|
||||
cmake_dependent_option(FT_REQUIRE_BROTLI
|
||||
"Require support of compressed WOFF2 fonts." OFF
|
||||
"NOT FT_DISABLE_BROTLI" OFF)
|
||||
|
||||
|
||||
# Disallow in-source builds
|
||||
|
@ -208,35 +245,45 @@ endif ()
|
|||
|
||||
|
||||
# Find dependencies
|
||||
set(HARFBUZZ_MIN_VERSION "2.0.0")
|
||||
if (FT_WITH_HARFBUZZ)
|
||||
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED)
|
||||
else ()
|
||||
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})
|
||||
if (NOT FT_DISABLE_HARFBUZZ)
|
||||
set(HARFBUZZ_MIN_VERSION "2.0.0")
|
||||
if (FT_REQUIRE_HARFBUZZ)
|
||||
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED)
|
||||
else ()
|
||||
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (FT_WITH_PNG)
|
||||
find_package(PNG REQUIRED)
|
||||
else ()
|
||||
find_package(PNG)
|
||||
if (NOT FT_DISABLE_PNG)
|
||||
if (FT_REQUIRE_PNG)
|
||||
find_package(PNG REQUIRED)
|
||||
else ()
|
||||
find_package(PNG)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (FT_WITH_ZLIB)
|
||||
find_package(ZLIB REQUIRED)
|
||||
else ()
|
||||
find_package(ZLIB)
|
||||
if (NOT FT_DISABLE_ZLIB)
|
||||
if (FT_REQUIRE_ZLIB)
|
||||
find_package(ZLIB REQUIRED)
|
||||
else ()
|
||||
find_package(ZLIB)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (FT_WITH_BZIP2)
|
||||
find_package(BZip2 REQUIRED)
|
||||
else ()
|
||||
find_package(BZip2)
|
||||
if (NOT FT_DISABLE_BZIP2)
|
||||
if (FT_REQUIRE_BZIP2)
|
||||
find_package(BZip2 REQUIRED)
|
||||
else ()
|
||||
find_package(BZip2)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (FT_WITH_BROTLI)
|
||||
find_package(BrotliDec REQUIRED)
|
||||
else ()
|
||||
find_package(BrotliDec)
|
||||
if (NOT FT_DISABLE_BROTLI)
|
||||
if (FT_REQUIRE_BROTLI)
|
||||
find_package(BrotliDec REQUIRED)
|
||||
else ()
|
||||
find_package(BrotliDec)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Create the configuration file
|
||||
|
@ -426,7 +473,7 @@ target_include_directories(
|
|||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
|
||||
|
||||
# Make <ftconfig.h> available for builds/unix/ftsystem.c.
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/freetype/config
|
||||
)
|
||||
|
|
|
@ -88,7 +88,6 @@ Details on the process can be found here:
|
|||
|
||||
Enjoy!
|
||||
|
||||
|
||||
The FreeType Team
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
|
|
@ -72,25 +72,20 @@ to execute `autogen.sh` in advance; this script clones the 'dlg' git
|
|||
submodule and copies some files into FreeType's source tree.
|
||||
|
||||
|
||||
contributing
|
||||
------------
|
||||
Code of Conduct
|
||||
---------------
|
||||
|
||||
If you want to contribute to FreeType it is recommended to install the
|
||||
`git-merge-changelog` program – we use a `ChangeLog` file, which often
|
||||
prevents simple merging due to conflicts. Most GNU/Linux
|
||||
distributions have a package for this program; otherwise you can
|
||||
install it via the 'gnulib' git repository. Detailed instructions can
|
||||
be found at the beginning of
|
||||
Please note that this project is released with a Contributor Code of
|
||||
Conduct (CoC). By participating in this project you agree to abide by
|
||||
its terms, which you can find in the following link:
|
||||
|
||||
https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/git-merge-changelog.c
|
||||
https://www.freedesktop.org/wiki/CodeOfConduct
|
||||
|
||||
To make it actually work, add to file `.git/config` in the FreeType
|
||||
git repository (or to your `$HOME/.gitconfig` file) the lines
|
||||
|
||||
[merge "merge-changelog"]
|
||||
name = GNU-style ChangeLog merge driver
|
||||
driver = /usr/local/bin/git-merge-changelog %O %A %B
|
||||
CoC issues may be raised to the project maintainers at the following
|
||||
address:
|
||||
|
||||
wl@gnu.org
|
||||
apodtele@gmail.com
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ Free_VecPooled( APTR poolHeader,
|
|||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
stream->base = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ typedef short ResourceIndex;
|
|||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
stream->base = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
aclocal.m4
|
||||
autom4te.cache
|
||||
config.cache
|
||||
config.guess
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.ac
|
||||
freetype2.pc
|
||||
freetype-config
|
||||
ftconfig.h
|
||||
ftoption.h
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
unix-cc.mk
|
||||
unix-def.mk
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -215,7 +215,7 @@
|
|||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
stream->base = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@
|
|||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
stream->base = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -365,7 +365,7 @@
|
|||
stream->descriptor.pointer = stream->base;
|
||||
stream->pathname.pointer = (char*)filepathname;
|
||||
|
||||
stream->read = 0;
|
||||
stream->read = NULL;
|
||||
|
||||
FT_TRACE1(( "FT_Stream_Open:" ));
|
||||
FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n",
|
||||
|
@ -409,7 +409,7 @@
|
|||
memory = (FT_Memory)malloc( sizeof ( *memory ) );
|
||||
if ( memory )
|
||||
{
|
||||
memory->user = 0;
|
||||
memory->user = NULL;
|
||||
memory->alloc = ft_alloc;
|
||||
memory->realloc = ft_realloc;
|
||||
memory->free = ft_free;
|
||||
|
|
|
@ -1,501 +0,0 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2013-12-25.23; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -197,7 +197,7 @@
|
|||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
stream->base = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,7 +259,7 @@
|
|||
stream->pathname.pointer = (char*)filepathname;
|
||||
|
||||
stream->close = ft_close_stream;
|
||||
stream->read = 0;
|
||||
stream->read = NULL;
|
||||
|
||||
FT_TRACE1(( "FT_Stream_Open:" ));
|
||||
FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
|
||||
|
@ -300,7 +300,7 @@
|
|||
memory = (FT_Memory)malloc( sizeof ( *memory ) );
|
||||
if ( memory )
|
||||
{
|
||||
memory->user = 0;
|
||||
memory->user = NULL;
|
||||
memory->alloc = ft_alloc;
|
||||
memory->realloc = ft_realloc;
|
||||
memory->free = ft_free;
|
||||
|
|
|
@ -230,7 +230,7 @@
|
|||
|
||||
/* const char* ft2_debug = getenv( "FT2_DEBUG" ); */
|
||||
|
||||
const char* ft2_debug = 0;
|
||||
const char* ft2_debug = NULL;
|
||||
|
||||
|
||||
if ( ft2_debug )
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# user-specific cache/settings files
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.suo
|
||||
*.user
|
|
@ -88,7 +88,7 @@
|
|||
dlg_handler ft_default_log_handler = NULL;
|
||||
FT_Custom_Log_Handler custom_output_handler = NULL;
|
||||
|
||||
#endif /* FT_DEBUG_LOGGING*/
|
||||
#endif /* FT_DEBUG_LOGGING */
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_ERROR
|
||||
|
|
|
@ -25,11 +25,10 @@
|
|||
#include <freetype/fttypes.h>
|
||||
#include <freetype/internal/ftstream.h>
|
||||
|
||||
/* memory-mapping includes and definitions */
|
||||
/* memory mapping and allocation includes and definitions */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
|
@ -69,9 +68,7 @@
|
|||
ft_alloc( FT_Memory memory,
|
||||
long size )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
|
||||
return malloc( size );
|
||||
return HeapAlloc( memory->user, 0, size );
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,10 +102,9 @@
|
|||
long new_size,
|
||||
void* block )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
FT_UNUSED( cur_size );
|
||||
|
||||
return realloc( block, new_size );
|
||||
return HeapReAlloc( memory->user, 0, block, new_size );
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,9 +127,7 @@
|
|||
ft_free( FT_Memory memory,
|
||||
void* block )
|
||||
{
|
||||
FT_UNUSED( memory );
|
||||
|
||||
free( block );
|
||||
HeapFree( memory->user, 0, block );
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,7 +170,7 @@
|
|||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
stream->base = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,7 +192,7 @@
|
|||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
stream->base = 0;
|
||||
stream->base = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,16 +211,36 @@
|
|||
return FT_THROW( Invalid_Stream_Handle );
|
||||
|
||||
/* open the file */
|
||||
file = CreateFileA( filepathname, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
|
||||
file = CreateFile( (LPCTSTR)filepathname, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
|
||||
if ( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
FT_ERROR(( "FT_Stream_Open:" ));
|
||||
FT_ERROR(( " could not open `%s'\n", filepathname ));
|
||||
return FT_THROW( Cannot_Open_Resource );
|
||||
/* fall back on the alernative interface */
|
||||
#ifdef UNICODE
|
||||
file = CreateFileA( (LPCSTR)filepathname, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
|
||||
#else
|
||||
file = CreateFileW( (LPCWSTR)filepathname, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
|
||||
#endif
|
||||
|
||||
if ( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
FT_ERROR(( "FT_Stream_Open:" ));
|
||||
FT_ERROR(( " could not open `%s'\n", filepathname ));
|
||||
return FT_THROW( Cannot_Open_Resource );
|
||||
}
|
||||
}
|
||||
|
||||
#if defined _WIN32_WCE || defined _WIN32_WINDOWS || \
|
||||
(defined _WIN32_WINNT && _WIN32_WINNT <= 0x0400)
|
||||
/* Use GetFileSize() for legacy Windows */
|
||||
size.u.LowPart = GetFileSize( file, (DWORD *)&size.u.HighPart );
|
||||
if ( size.u.LowPart == INVALID_FILE_SIZE && GetLastError() != NO_ERROR )
|
||||
#else
|
||||
/* Use GetFileSizeEx() for modern Windows */
|
||||
if ( GetFileSizeEx( file, &size ) == FALSE )
|
||||
#endif
|
||||
{
|
||||
FT_ERROR(( "FT_Stream_Open:" ));
|
||||
FT_ERROR(( " could not retrieve size of file `%s'\n", filepathname ));
|
||||
|
@ -280,7 +294,7 @@
|
|||
{
|
||||
FT_ERROR(( "FT_Stream_Open:" ));
|
||||
FT_ERROR(( " could not `alloc' memory\n" ));
|
||||
goto Fail_Map;
|
||||
goto Fail_Open;
|
||||
}
|
||||
|
||||
total_read_count = 0;
|
||||
|
@ -311,7 +325,7 @@
|
|||
stream->descriptor.pointer = stream->base;
|
||||
stream->pathname.pointer = (char*)filepathname;
|
||||
|
||||
stream->read = 0;
|
||||
stream->read = NULL;
|
||||
|
||||
FT_TRACE1(( "FT_Stream_Open:" ));
|
||||
FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n",
|
||||
|
@ -322,9 +336,6 @@
|
|||
Fail_Read:
|
||||
ft_free( NULL, stream->base );
|
||||
|
||||
Fail_Map:
|
||||
CloseHandle( file );
|
||||
|
||||
Fail_Open:
|
||||
CloseHandle( file );
|
||||
|
||||
|
@ -352,13 +363,17 @@
|
|||
FT_BASE_DEF( FT_Memory )
|
||||
FT_New_Memory( void )
|
||||
{
|
||||
HANDLE heap;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
memory = (FT_Memory)malloc( sizeof ( *memory ) );
|
||||
heap = GetProcessHeap();
|
||||
memory = heap ? (FT_Memory)HeapAlloc( heap, 0, sizeof ( *memory ) )
|
||||
: NULL;
|
||||
|
||||
if ( memory )
|
||||
{
|
||||
memory->user = 0;
|
||||
memory->user = heap;
|
||||
memory->alloc = ft_alloc;
|
||||
memory->realloc = ft_realloc;
|
||||
memory->free = ft_free;
|
||||
|
|
|
@ -44,35 +44,35 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -242,7 +242,6 @@
|
|||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4001</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
|
@ -296,7 +295,6 @@
|
|||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4001</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
|
@ -45,6 +45,7 @@
|
|||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;DLL_EXPORT"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
WarningLevel="4"
|
||||
|
@ -95,7 +96,7 @@
|
|||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
|
@ -121,6 +122,7 @@
|
|||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
WarningLevel="4"
|
||||
|
@ -165,7 +167,7 @@
|
|||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
|
@ -238,7 +240,7 @@
|
|||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +0,0 @@
|
|||
Support for a cmake build has been contributed. See the remarks in the
|
||||
top-level `CMakeLists.txt' file for more.
|
|
@ -1,152 +0,0 @@
|
|||
How to customize the compilation of the library
|
||||
===============================================
|
||||
|
||||
FreeType is highly customizable to fit various needs, and this
|
||||
document describes how it is possible to select options and
|
||||
components at compilation time.
|
||||
|
||||
|
||||
I. Configuration macros
|
||||
|
||||
The file `include/freetype/config/ftoption.h' contains a list of
|
||||
commented configuration macros that can be toggled by developers to
|
||||
indicate which features should be active while building the library.
|
||||
|
||||
These options range from debug level to availability of certain
|
||||
features, like native TrueType hinting through a bytecode
|
||||
interpreter.
|
||||
|
||||
We invite you to read this file for more information. You can
|
||||
change the file's content to suit your needs, or override it with
|
||||
one of the techniques described below.
|
||||
|
||||
|
||||
II. Modules list
|
||||
|
||||
If you use GNU make please edit the top-level file `modules.cfg'.
|
||||
It contains a list of available FreeType modules and extensions to
|
||||
be compiled. Change it to suit your own preferences. Be aware that
|
||||
certain modules depend on others, as described in the file. GNU
|
||||
make uses `modules.cfg' to generate `ftmodule.h' (in the object
|
||||
directory).
|
||||
|
||||
If you build FreeType in a directory separate from the source files,
|
||||
put your customized `modules.cfg' in that directory; that way you
|
||||
can keep the source files `clean'.
|
||||
|
||||
If you don't use GNU make you have to manually edit the file
|
||||
`include/freetype/config/ftmodule.h' (which is *not* used with if
|
||||
compiled with GNU make) to add or remove the drivers and components
|
||||
you want to compile into the library. See `INSTALL.ANY' for more
|
||||
information.
|
||||
|
||||
|
||||
III. System interface
|
||||
|
||||
FreeType's default interface to the system (i.e., the parts that
|
||||
deal with memory management and i/o streams) is located in
|
||||
`src/base/ftsystem.c'.
|
||||
|
||||
The current implementation uses standard C library calls to manage
|
||||
memory and to read font files. It is however possible to write
|
||||
custom implementations to suit specific systems.
|
||||
|
||||
To tell the GNU Make-based build system to use a custom system
|
||||
interface, you have to define the environment variable FTSYS_SRC to
|
||||
point to the relevant implementation:
|
||||
|
||||
on Unix:
|
||||
|
||||
./configure <your options>
|
||||
export FTSYS_SRC=foo/my_ftsystem.c
|
||||
make
|
||||
make install
|
||||
|
||||
on Windows:
|
||||
|
||||
make setup <compiler>
|
||||
set FTSYS_SRC=foo/my_ftsystem.c
|
||||
make
|
||||
|
||||
|
||||
IV. Overriding default configuration and module headers
|
||||
|
||||
It is possible to override the default configuration and module
|
||||
headers without changing the original files. There are three ways
|
||||
to do that:
|
||||
|
||||
|
||||
1. With GNU make
|
||||
|
||||
[This is actually a combination of method 2 and 3.]
|
||||
|
||||
Just put your custom `ftoption.h' file into the objects directory
|
||||
(normally `<topdir>/objs' if you build in the source tree, or the
|
||||
directory where you invoke configure if you build in a separate
|
||||
directory), which GNU make prefers over the standard location. No
|
||||
action is needed for `ftmodule.h' because it is generated
|
||||
automatically in the objects directory.
|
||||
|
||||
2. Using the C include path
|
||||
|
||||
Use the C include path to ensure that your own versions of the
|
||||
files are used at compile time when the lines
|
||||
|
||||
#include FT_CONFIG_OPTIONS_H
|
||||
#include FT_CONFIG_MODULES_H
|
||||
|
||||
are compiled. Their default values being
|
||||
<freetype/config/ftoption.h> and <freetype/config/ftmodule.h>, you
|
||||
can do something like:
|
||||
|
||||
custom/
|
||||
config/
|
||||
ftoption.h => custom options header
|
||||
ftmodule.h => custom modules list
|
||||
|
||||
include/ => normal FreeType 2 include
|
||||
...
|
||||
|
||||
then change the C include path to always give the path to `custom'
|
||||
before the FreeType 2 `include'.
|
||||
|
||||
|
||||
3. Redefining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
|
||||
|
||||
Another way to do the same thing is to redefine the macros used to
|
||||
name the configuration headers. To do so, you need a custom
|
||||
`ft2build.h' whose content can be as simple as:
|
||||
|
||||
#ifndef FT2_BUILD_MY_PLATFORM_H_
|
||||
#define FT2_BUILD_MY_PLATFORM_H_
|
||||
|
||||
#define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
|
||||
#define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
|
||||
|
||||
#include <freetype/config/ftheader.h>
|
||||
|
||||
#endif /* FT2_BUILD_MY_PLATFORM_H_ */
|
||||
|
||||
Place those files in a separate directory, e.g.,
|
||||
|
||||
custom/
|
||||
ft2build.h => custom version described above
|
||||
my-ftoption.h => custom options header
|
||||
my-ftmodule.h => custom modules list header
|
||||
|
||||
and change the C include path to ensure that `custom' is always
|
||||
placed before the FT2 `include' during compilation.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2003-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of CUSTOMIZE ---
|
|
@ -1,310 +0,0 @@
|
|||
Debugging within the FreeType sources
|
||||
=====================================
|
||||
|
||||
I. Configuration macros
|
||||
-----------------------
|
||||
|
||||
There are several ways to enable debugging features in a FreeType 2
|
||||
builds. This is controlled through the definition of special macros
|
||||
located in the file `ftoption.h'. The macros are:
|
||||
|
||||
|
||||
FT_DEBUG_LEVEL_ERROR
|
||||
|
||||
#define this macro if you want to compile the `FT_ERROR' macro
|
||||
calls to print error messages during program execution. This does
|
||||
not stop the program. Very useful to spot invalid fonts during
|
||||
development and to code workarounds for them.
|
||||
|
||||
FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
#define this macro if you want to compile both macros `FT_ERROR'
|
||||
and `FT_TRACE'. This also includes the variants `FT_TRACE0',
|
||||
`FT_TRACE1', `FT_TRACE2', ..., `FT_TRACE7'.
|
||||
|
||||
The trace macros are used to send debugging messages when an
|
||||
appropriate `debug level' is configured at runtime through the
|
||||
`FT2_DEBUG' environment variable (more on this later).
|
||||
|
||||
FT_DEBUG_MEMORY
|
||||
|
||||
If this macro is #defined, the FreeType engine is linked with a
|
||||
small but effective debugging memory manager that tracks all
|
||||
allocations and frees that are performed within the font engine.
|
||||
|
||||
When the `FT2_DEBUG_MEMORY' environment variable is defined at
|
||||
runtime, a call to `FT_Done_FreeType' dumps memory statistics,
|
||||
including the list of leaked memory blocks and optionally with the
|
||||
source locations where these were allocated. It is always a very
|
||||
good idea to define this in development builds. This works with
|
||||
_any_ program linked to FreeType, but requires a big deal of
|
||||
memory (the debugging memory manager never frees the blocks to the
|
||||
heap in order to detect double frees).
|
||||
|
||||
When `FT2_DEBUG_MEMORY' isn't defined at runtime, the debugging
|
||||
memory manager is ignored, and performance is unaffected.
|
||||
|
||||
FT_DEBUG_LOGGING
|
||||
|
||||
#define this macro for enhanced logging support; it automatically
|
||||
sets `FT_DEBUG_LEVEL_TRACE' and `FT_DEBUG_LEVEL_ERROR'.
|
||||
|
||||
If defined, `FT_TRACE' and `FT_ERROR' can send tracing and
|
||||
debugging messages to a file. The location of the log file has to
|
||||
be set with the `FT_LOGGING_FILE' environment variable (more on
|
||||
this later).
|
||||
|
||||
The main enhancements are the possibility of logging the time and
|
||||
the name of the `FT_COMPONENT' macro together with the affected
|
||||
`FT_TRACE' or `FT_ERROR' calls. See below how to activate this in
|
||||
the `FT2_DEBUG' environment variable.
|
||||
|
||||
|
||||
II. Debugging macros
|
||||
--------------------
|
||||
|
||||
Several macros can be used within the FreeType sources to help
|
||||
debugging its code:
|
||||
|
||||
|
||||
1. FT_ERROR(( ... ))
|
||||
|
||||
This macro is used to send debug messages that indicate relatively
|
||||
serious errors (like broken font files) without stopping the
|
||||
execution of the running program. Its code is compiled only when
|
||||
either `FT_DEBUG_LEVEL_ERROR' or `FT_DEBUG_LEVEL_TRACE' are
|
||||
defined in `ftoption.h'.
|
||||
|
||||
Note that you have to use a printf-like signature, but with double
|
||||
parentheses, like in
|
||||
|
||||
FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
|
||||
|
||||
|
||||
2. FT_ASSERT( condition )
|
||||
|
||||
This macro is used to check strong assertions at runtime. If its
|
||||
condition isn't TRUE, the program aborts with a panic message.
|
||||
Its code is compiled when either `FT_DEBUG_LEVEL_ERROR' or
|
||||
`FT_DEBUG_LEVEL_TRACE' are defined. You don't need double
|
||||
parentheses here. Example:
|
||||
|
||||
FT_ASSERT( ptr != NULL );
|
||||
|
||||
|
||||
3. FT_TRACE( level, (message...) )
|
||||
|
||||
The `FT_TRACE' macro is used to send general-purpose debugging
|
||||
messages during program execution. This macro uses an *implicit*
|
||||
macro named `FT_COMPONENT', which names the current FreeType
|
||||
component being run.
|
||||
|
||||
The developer should always define `FT_COMPONENT' as appropriate,
|
||||
for example as in
|
||||
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT io
|
||||
|
||||
The value of the `FT_COMPONENT' macro is one of the component
|
||||
names defined in the internal file `internal/fttrace.h'. If you
|
||||
modify the FreeType source code and insert a new `FT_COMPONENT'
|
||||
macro, you must register it in `fttrace.h'. If you insert or
|
||||
remove many trace macros, you can test for undefined or unused
|
||||
trace macros with the script `src/tools/chktrcmp.py'.
|
||||
|
||||
Each such component is assigned a `debug level', ranging from
|
||||
value 0 to 7, through the use of the `FT2_DEBUG' environment
|
||||
variable (described below) when a program linked with FreeType
|
||||
starts.
|
||||
|
||||
When `FT_TRACE' is called, its level is compared to the one of the
|
||||
corresponding component. Messages with trace levels *higher* than
|
||||
the corresponding component level are filtered out and never
|
||||
printed. This means that trace messages with level 0 are always
|
||||
printed, those with level 2 are only printed when the component
|
||||
level is *at least* 2, etc.
|
||||
|
||||
The second parameter to `FT_TRACE' must contain parentheses and
|
||||
corresponds to a printf-like call, as in
|
||||
|
||||
FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
|
||||
|
||||
The shortcut macros `FT_TRACE0', `FT_TRACE1', `FT_TRACE2', ...,
|
||||
`FT_TRACE7' can be used with constant level indices, and are much
|
||||
cleaner to use, as in
|
||||
|
||||
FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
|
||||
|
||||
|
||||
III. Environment variables
|
||||
--------------------------
|
||||
|
||||
The following environment variables control debugging output and
|
||||
behaviour of FreeType at runtime.
|
||||
|
||||
|
||||
FT2_DEBUG
|
||||
|
||||
This variable is only used when FreeType is built with
|
||||
`FT_DEBUG_LEVEL_TRACE' defined. It contains a list of component
|
||||
level definitions, following this format:
|
||||
|
||||
component1:level1 component2:level2 component3:level3 ...
|
||||
|
||||
where `componentX' is the name of a tracing component, as defined
|
||||
in `fttrace.h'. `levelX' is the corresponding level to use at
|
||||
runtime.
|
||||
|
||||
`any' is a special component name that is interpreted as `any/all
|
||||
components'. For example, the following definitions
|
||||
|
||||
set FT2_DEBUG=any:2 memory:5 io:4 (on Windows)
|
||||
export FT2_DEBUG="any:2 memory:5 io:4" (on Linux with bash)
|
||||
|
||||
both stipulate that all components should have level 2, except for
|
||||
the memory and io components, which are set to the trace levels 5
|
||||
and 4, respectively.
|
||||
|
||||
If `FT_DEBUG_LOGGING' is defined, two more options are available.
|
||||
|
||||
* -v: Print also the name of FreeType's component from which the
|
||||
current log is produced, together with the tracing level.
|
||||
|
||||
* -t: Print also the time.
|
||||
|
||||
Here are some examples how the output might look like.
|
||||
|
||||
FT2_DEBUG="any:7 memory:5 -vt"
|
||||
|
||||
=> [20:32:02:44969 ttload:2] table directory loaded
|
||||
|
||||
FT2_DEBUG="any:7 memory:5 -t"
|
||||
|
||||
=> [20:32:02:44969] table directory loaded
|
||||
|
||||
FT2_DEBUG="any:7 memory:5 -v"
|
||||
|
||||
=> [ttload:2] table directory loaded
|
||||
|
||||
|
||||
FT_LOGGING_FILE
|
||||
|
||||
This variable is only used if FreeType is built with the
|
||||
`FT_DEBUG_LOGGING' macro defined. It contains the path to the
|
||||
file where the user wants to put his log file. If it is not set,
|
||||
FreeType uses stderr.
|
||||
|
||||
Examples:
|
||||
|
||||
On UNIX-like systems with bash:
|
||||
export FT_LOGGING_FILE="/tmp/freetype2.log"
|
||||
|
||||
On Windows:
|
||||
set FT_LOGGING_FILE=C:\Users\AppData\Local\Temp\freetype2.log
|
||||
|
||||
|
||||
FT2_DEBUG_MEMORY
|
||||
|
||||
This environment variable, when defined, tells FreeType to use a
|
||||
debugging memory manager that tracks leaking memory blocks as well
|
||||
as other common errors like double frees. It is also capable of
|
||||
reporting _where_ the leaking blocks were allocated, which
|
||||
considerably saves time when debugging new additions to the
|
||||
library.
|
||||
|
||||
This code is only compiled when FreeType is built with the
|
||||
`FT_DEBUG_MEMORY' macro #defined in `ftoption.h' though, it is
|
||||
ignored in other builds.
|
||||
|
||||
|
||||
FT2_ALLOC_TOTAL_MAX
|
||||
|
||||
This variable is ignored if `FT2_DEBUG_MEMORY' is not defined. It
|
||||
allows you to specify a maximum heap size for all memory
|
||||
allocations performed by FreeType. This is very useful to test
|
||||
the robustness of the font engine and programs that use it in
|
||||
tight memory conditions.
|
||||
|
||||
If it is undefined, or if its value is not strictly positive, no
|
||||
allocation bounds are checked at runtime.
|
||||
|
||||
|
||||
FT2_ALLOC_COUNT_MAX
|
||||
|
||||
This variable is ignored if `FT2_DEBUG_MEMORY' is not defined. It
|
||||
allows you to specify a maximum number of memory allocations
|
||||
performed by FreeType before returning the error
|
||||
`FT_Err_Out_Of_Memory'. This is useful for debugging and testing
|
||||
the engine's robustness.
|
||||
|
||||
If it is undefined, or if its value is not strictly positive, no
|
||||
allocation bounds are checked at runtime.
|
||||
|
||||
|
||||
FT2_KEEP_ALIVE
|
||||
|
||||
This variable is ignored if `FT2_DEBUG_MEMORY' is not defined.
|
||||
`Keep alive' means that freed blocks aren't released to the heap.
|
||||
This is useful to detect double-frees or weird heap corruption,
|
||||
reporting the source code location of the original allocation and
|
||||
deallocation in case of a problem. It uses large amounts of
|
||||
memory, however.
|
||||
|
||||
If it is undefined, or if its value is not strictly positive,
|
||||
freed blocks are released at runtime.
|
||||
|
||||
|
||||
IV. Additional Capabilities with `FT_DEBUG_LOGGING'
|
||||
---------------------------------------------------
|
||||
|
||||
If `FT_DEBUG_LOGGING' is defined, four APIs are available to provide
|
||||
additional debugging support. Use
|
||||
|
||||
#include <freetype/ftlogging.h>
|
||||
|
||||
to access them.
|
||||
|
||||
FT_Trace_Set_Level( const char* level )
|
||||
|
||||
By default, FreeType uses the tracing levels set in the
|
||||
`FT2_DEBUG' environment variable. Use this function to override
|
||||
the value with `level'. Use value `NULL' to disable tracing.
|
||||
|
||||
FT_Trace_Set_Default_Level():
|
||||
|
||||
Reset the tracing levels to the default value, i.e., the value of
|
||||
the `FT2_DEBUG' environment variable or no tracing if not set.
|
||||
|
||||
FT_Set_Log_Handler( ft_custom_log_handler handler ):
|
||||
|
||||
Use `handler' as a custom handler for formatting tracing and error
|
||||
messages. The `ft_custom_log_handler' typedef has the following
|
||||
prototype.
|
||||
|
||||
void
|
||||
(*ft_custom_log_handler)( const char* ft_component,
|
||||
const char* fmt,
|
||||
va_list args );
|
||||
|
||||
`ft_component' is the current component like `ttload', `fmt' is the
|
||||
first argument of `FT_TRACE' or `FT_ERROR', and `args' holds the
|
||||
remaining arguments.
|
||||
|
||||
FT_Set_Default_Log_Handler():
|
||||
|
||||
Reset the log handler to the default version.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2002-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute this
|
||||
file you indicate that you have read the license and understand and
|
||||
accept it fully.
|
||||
|
||||
|
||||
--- end of DEBUG ---
|
|
@ -1,298 +0,0 @@
|
|||
Introduction
|
||||
------------
|
||||
|
||||
Documentation is an extremely important part of any project, and it
|
||||
helps a lot if it uses consistent syntax and layout.
|
||||
|
||||
The documentation for the FreeType library is maintained in header
|
||||
files in the `include/` directory in the form of code comments. These
|
||||
comments are extracted and organized by 'docwriter' (previously
|
||||
'docmaker'). The generated docs can be viewed in the
|
||||
`docs/reference/site/` directory after running `make refdoc`.
|
||||
|
||||
Documentation comments follow a specific structure and format as
|
||||
described below.
|
||||
|
||||
|
||||
Documentation Structure
|
||||
-----------------------
|
||||
|
||||
The documentation is divided into multiple chapters, which contain
|
||||
sections relevant to it. The chapter details and sections contained
|
||||
in them are listed in `include/freetype/ftchapters.h`. Any unlisted
|
||||
section is added to the 'Miscellaneous' chapter.
|
||||
|
||||
Sections may contain sub-sections which consist of properties,
|
||||
enumerations, and other data types.
|
||||
|
||||
|
||||
Comment Blocks
|
||||
--------------
|
||||
|
||||
Documentation blocks follow a specific format:
|
||||
|
||||
/***************************** (should end on column 77)
|
||||
*
|
||||
* (1 asterisk, 1 space, then content)
|
||||
*
|
||||
*/ (end of block)
|
||||
|
||||
To make 'docwriter' recognize a comment block, there must be at least
|
||||
two asterisks in the first line. As a consequence, you should change
|
||||
the second asterisk to something else if you want to prevent a comment
|
||||
block being handled by 'docwriter' (for example, change `/****/` to
|
||||
`/*#**/`).
|
||||
|
||||
|
||||
Markup Tags
|
||||
-----------
|
||||
|
||||
Markup tags are used to indicate what comes next. The syntax for a
|
||||
tag is:
|
||||
|
||||
@foo:
|
||||
|
||||
An `@`, followed by the tag, and then `:`.
|
||||
|
||||
|
||||
Reserved Tags
|
||||
-------------
|
||||
|
||||
There are some keywords that have a special meaning to docwriter.
|
||||
As a convention, all keywords are written in lowercase.
|
||||
|
||||
* `chapter`: Defines a chapter. Usually the title with underscores.
|
||||
* `sections`: List of sections in the chapter, in order.
|
||||
* `section`: Defines the start or continuation of a section.
|
||||
* `title`: Title for a chapter or section. May contain spaces.
|
||||
* `abstract`: The abstract for a section, visible in the Table of
|
||||
Contents (TOC).
|
||||
* `description`: Detailed description of a tag (except chapters),
|
||||
shown as synopsis.
|
||||
* `values`: A list of 'values' for the tag. These values are used for
|
||||
cross-referencing.
|
||||
|
||||
|
||||
Other Tags
|
||||
----------
|
||||
|
||||
Except the ones given above, any other tags will be added as a part of
|
||||
a subsection. All tags are lowercase by convention.
|
||||
|
||||
|
||||
Public Header Definitions
|
||||
-------------------------
|
||||
|
||||
The public headers for FreeType have their names defined in
|
||||
`include/freetype/config/ftheader.h`. Any new public header file must
|
||||
be defined in this file, in the following format:
|
||||
|
||||
#define FT_NEWNAME_H <freetype/newname.h>
|
||||
|
||||
Where `newname` is the name of the header file.
|
||||
|
||||
This macro is combined with the file location of a sub-section and
|
||||
printed with the object.
|
||||
|
||||
|
||||
Note on code blocks captured after comments
|
||||
-------------------------------------------
|
||||
|
||||
All non-documentation lines after a documentation comment block are
|
||||
captured to be displayed as the code for the sub-section. To stop
|
||||
collection, a line with `/* */` should be added.
|
||||
|
||||
|
||||
General Formatting Conventions
|
||||
------------------------------
|
||||
|
||||
* Use two spaces after a full stop ending a sentence.
|
||||
* Use appropriate uppercasing in titles. Refer
|
||||
|
||||
https://english.stackexchange.com/a/34
|
||||
|
||||
for more information.
|
||||
* Do not add trailing parentheses when citing a C function.
|
||||
|
||||
|
||||
Markdown Usage
|
||||
--------------
|
||||
|
||||
All tags, except the ones that define the name and title for a block
|
||||
support markdown in them. Docwriter uses a markdown parser that
|
||||
follows rules given in John Gruber's markdown guide:
|
||||
|
||||
https://daringfireball.net/projects/markdown/syntax
|
||||
|
||||
with a few exceptions and extensions, detailed below. This may also
|
||||
be referred to as the **FreeType Flavored Markdown**.
|
||||
|
||||
|
||||
Headers
|
||||
-------
|
||||
|
||||
Markdown headers should not be used directly, because these are added
|
||||
based on section titles, sub-section names, and tags. However, if a
|
||||
header needs to be added, note the following correspondence to HTML tags:
|
||||
|
||||
* Section title on top of the page is `H1`.
|
||||
* Sub-section titles are `H2`.
|
||||
* Parts of sub-sections are `H4`.
|
||||
* Any header added will be visible in the Table of Contents (TOC) of
|
||||
the page.
|
||||
|
||||
|
||||
Emphasis
|
||||
--------
|
||||
|
||||
* Use `_underscores_` for italics.
|
||||
* Use `**double asterisks**` for bold.
|
||||
|
||||
Although the other notations (double underscore for bold, single
|
||||
asterisk for italics) are supported, it is recommended to use the
|
||||
above for consistency.
|
||||
|
||||
Note that there may be cases where having two asterisks or underscores
|
||||
in a line may lead to text being picked up as italics or bold.
|
||||
Although unintentional, this is correct markdown behavior.
|
||||
|
||||
For inline code, wrap the sequence with backticks (see below). This
|
||||
renders symbols correctly without modifications. If a symbol is
|
||||
absolutely required outside of an inline code block or code sequence,
|
||||
escape it with a backslash (like `\*` or `\_`).
|
||||
|
||||
|
||||
Lists
|
||||
-----
|
||||
|
||||
Unordered lists can be created with asterisks:
|
||||
|
||||
* Unordered list items can use asterisks.
|
||||
* Another list item.
|
||||
|
||||
Ordered lists start with numbers:
|
||||
|
||||
1. This is an ordered list item.
|
||||
2. Brackets after numbers won't work.
|
||||
|
||||
To continue a list over multiple paragraphs, indent them with at least
|
||||
four spaces. For example:
|
||||
|
||||
1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
|
||||
viverra nec, fringilla in, laoreet vitae, risus.
|
||||
|
||||
Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
|
||||
Suspendisse id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
2. This is the second list item.
|
||||
|
||||
This paragraph is not a part of the list.
|
||||
|
||||
More information on lists in markdown is available at
|
||||
|
||||
https://daringfireball.net/projects/markdown/syntax#list
|
||||
|
||||
|
||||
Cross-references
|
||||
----------------
|
||||
|
||||
Other sub-sections can be linked with the `@` symbol:
|
||||
|
||||
@description:
|
||||
While FreeType's CFF driver doesn't expose API functions by
|
||||
itself, it is possible to control its behaviour with
|
||||
@FT_Property_Set and @FT_Property_Get.
|
||||
|
||||
If a field in the `values` table of another sub-section is linked, the
|
||||
link leads to its parent sub-section.
|
||||
|
||||
|
||||
Links and Images
|
||||
----------------
|
||||
|
||||
All URLs are converted to links in the HTML documentation.
|
||||
|
||||
Markdown syntax for links and images are fully supported.
|
||||
|
||||
|
||||
Inline Code
|
||||
-----------
|
||||
|
||||
To indicate a span of code, wrap it with backtick quotes (`` ` ``):
|
||||
|
||||
Use the `printf()` function.
|
||||
|
||||
Cross-references, markdown, and html styling do not work in inline code
|
||||
sequences.
|
||||
|
||||
|
||||
Code and Syntax Highlighting
|
||||
----------------------------
|
||||
|
||||
Blocks of code are fenced by lines with three back-ticks `` ``` ``
|
||||
followed by the language name, if any (used for syntax highlighting),
|
||||
as demonstrated in the following example.
|
||||
|
||||
```c
|
||||
x = y + z;
|
||||
if ( zookoo == 2 )
|
||||
{
|
||||
foobar();
|
||||
}
|
||||
```
|
||||
|
||||
Note that the indentation of the opening line and the closing line
|
||||
must be exactly the same. The code sequence itself should have a
|
||||
larger indentation than the surrounding back-ticks.
|
||||
|
||||
Like inline code, markdown and html styling is *not* supported inside
|
||||
code blocks.
|
||||
|
||||
|
||||
Tables
|
||||
------
|
||||
|
||||
Tables are used to list values, input, and other fields. The FreeType
|
||||
Flavored Markdown adopts a simple approach to tables with two columns,
|
||||
or field definition tables.
|
||||
|
||||
Field definition names may contain alphanumeric, underscore, and the
|
||||
`.` characters. This is followed by `::`. The following lines are
|
||||
the second column of the table. A field definition ends with the
|
||||
start of another field definition, or a markup tag.
|
||||
|
||||
@Input:
|
||||
pathname ::
|
||||
A path to the font file.
|
||||
|
||||
face_index ::
|
||||
See @FT_Open_Face for a detailed description of this
|
||||
parameter.
|
||||
|
||||
|
||||
Non-breaking Space
|
||||
------------------
|
||||
|
||||
A tilde can be used to create a non-breaking space. The example
|
||||
|
||||
The encoding value~0 is reserved.
|
||||
|
||||
is converted to
|
||||
|
||||
The encoding value 0 is reserved.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2018-2021 by
|
||||
Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of DOCGUIDE ---
|
|
@ -1,169 +0,0 @@
|
|||
The FreeType Project LICENSE
|
||||
----------------------------
|
||||
|
||||
2006-Jan-27
|
||||
|
||||
Copyright 1996-2002, 2006 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
The FreeType Project is distributed in several archive packages;
|
||||
some of them may contain, in addition to the FreeType font engine,
|
||||
various tools and contributions which rely on, or relate to, the
|
||||
FreeType Project.
|
||||
|
||||
This license applies to all files found in such packages, and
|
||||
which do not fall under their own explicit license. The license
|
||||
affects thus the FreeType font engine, the test programs,
|
||||
documentation and makefiles, at the very least.
|
||||
|
||||
This license was inspired by the BSD, Artistic, and IJG
|
||||
(Independent JPEG Group) licenses, which all encourage inclusion
|
||||
and use of free software in commercial and freeware products
|
||||
alike. As a consequence, its main points are that:
|
||||
|
||||
o We don't promise that this software works. However, we will be
|
||||
interested in any kind of bug reports. (`as is' distribution)
|
||||
|
||||
o You can use this software for whatever you want, in parts or
|
||||
full form, without having to pay us. (`royalty-free' usage)
|
||||
|
||||
o You may not pretend that you wrote this software. If you use
|
||||
it, or only parts of it, in a program, you must acknowledge
|
||||
somewhere in your documentation that you have used the
|
||||
FreeType code. (`credits')
|
||||
|
||||
We specifically permit and encourage the inclusion of this
|
||||
software, with or without modifications, in commercial products.
|
||||
We disclaim all warranties covering The FreeType Project and
|
||||
assume no liability related to The FreeType Project.
|
||||
|
||||
|
||||
Finally, many people asked us for a preferred form for a
|
||||
credit/disclaimer to use in compliance with this license. We thus
|
||||
encourage you to use the following text:
|
||||
|
||||
"""
|
||||
Portions of this software are copyright © <year> The FreeType
|
||||
Project (www.freetype.org). All rights reserved.
|
||||
"""
|
||||
|
||||
Please replace <year> with the value from the FreeType version you
|
||||
actually use.
|
||||
|
||||
|
||||
Legal Terms
|
||||
===========
|
||||
|
||||
0. Definitions
|
||||
--------------
|
||||
|
||||
Throughout this license, the terms `package', `FreeType Project',
|
||||
and `FreeType archive' refer to the set of files originally
|
||||
distributed by the authors (David Turner, Robert Wilhelm, and
|
||||
Werner Lemberg) as the `FreeType Project', be they named as alpha,
|
||||
beta or final release.
|
||||
|
||||
`You' refers to the licensee, or person using the project, where
|
||||
`using' is a generic term including compiling the project's source
|
||||
code as well as linking it to form a `program' or `executable'.
|
||||
This program is referred to as `a program using the FreeType
|
||||
engine'.
|
||||
|
||||
This license applies to all files distributed in the original
|
||||
FreeType Project, including all source code, binaries and
|
||||
documentation, unless otherwise stated in the file in its
|
||||
original, unmodified form as distributed in the original archive.
|
||||
If you are unsure whether or not a particular file is covered by
|
||||
this license, you must contact us to verify this.
|
||||
|
||||
The FreeType Project is copyright (C) 1996-2000 by David Turner,
|
||||
Robert Wilhelm, and Werner Lemberg. All rights reserved except as
|
||||
specified below.
|
||||
|
||||
1. No Warranty
|
||||
--------------
|
||||
|
||||
THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
|
||||
USE, OF THE FREETYPE PROJECT.
|
||||
|
||||
2. Redistribution
|
||||
-----------------
|
||||
|
||||
This license grants a worldwide, royalty-free, perpetual and
|
||||
irrevocable right and license to use, execute, perform, compile,
|
||||
display, copy, create derivative works of, distribute and
|
||||
sublicense the FreeType Project (in both source and object code
|
||||
forms) and derivative works thereof for any purpose; and to
|
||||
authorize others to exercise some or all of the rights granted
|
||||
herein, subject to the following conditions:
|
||||
|
||||
o Redistribution of source code must retain this license file
|
||||
(`FTL.TXT') unaltered; any additions, deletions or changes to
|
||||
the original files must be clearly indicated in accompanying
|
||||
documentation. The copyright notices of the unaltered,
|
||||
original files must be preserved in all copies of source
|
||||
files.
|
||||
|
||||
o Redistribution in binary form must provide a disclaimer that
|
||||
states that the software is based in part of the work of the
|
||||
FreeType Team, in the distribution documentation. We also
|
||||
encourage you to put an URL to the FreeType web page in your
|
||||
documentation, though this isn't mandatory.
|
||||
|
||||
These conditions apply to any software derived from or based on
|
||||
the FreeType Project, not just the unmodified files. If you use
|
||||
our work, you must acknowledge us. However, no fee need be paid
|
||||
to us.
|
||||
|
||||
3. Advertising
|
||||
--------------
|
||||
|
||||
Neither the FreeType authors and contributors nor you shall use
|
||||
the name of the other for commercial, advertising, or promotional
|
||||
purposes without specific prior written permission.
|
||||
|
||||
We suggest, but do not require, that you use one or more of the
|
||||
following phrases to refer to this software in your documentation
|
||||
or advertising materials: `FreeType Project', `FreeType Engine',
|
||||
`FreeType library', or `FreeType Distribution'.
|
||||
|
||||
As you have not signed this license, you are not required to
|
||||
accept it. However, as the FreeType Project is copyrighted
|
||||
material, only this license, or another one contracted with the
|
||||
authors, grants you the right to use, distribute, and modify it.
|
||||
Therefore, by using, distributing, or modifying the FreeType
|
||||
Project, you indicate that you understand and accept all the terms
|
||||
of this license.
|
||||
|
||||
4. Contacts
|
||||
-----------
|
||||
|
||||
There are two mailing lists related to FreeType:
|
||||
|
||||
o freetype@nongnu.org
|
||||
|
||||
Discusses general use and applications of FreeType, as well as
|
||||
future and wanted additions to the library and distribution.
|
||||
If you are looking for support, start in this list if you
|
||||
haven't found anything to help you in the documentation.
|
||||
|
||||
o freetype-devel@nongnu.org
|
||||
|
||||
Discusses bugs, as well as engine internals, design issues,
|
||||
specific licenses, porting, etc.
|
||||
|
||||
Our home page can be found at
|
||||
|
||||
https://www.freetype.org
|
||||
|
||||
|
||||
--- end of FTL.TXT ---
|
|
@ -1,340 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
|
@ -1,113 +0,0 @@
|
|||
|
||||
There are several ways to build the FreeType library, depending on
|
||||
your system and the level of customization you need. Here is a short
|
||||
overview of the documentation available:
|
||||
|
||||
|
||||
I. Prerequisites and dependencies
|
||||
=================================
|
||||
|
||||
FreeType is a low level C library that only depends on the standard
|
||||
C library with very few platform-dependent optimizations utilized at
|
||||
build time. System libraries, such as zlib, Gzip, bzip2, Brotli,
|
||||
and libpng, might be used to handle compressed fonts or decode
|
||||
embedded PNG glyphs.
|
||||
|
||||
FreeType auto-configuration scripts should be able to detect the
|
||||
prerequisites if the necessary headers are available at the default
|
||||
locations. Otherwise, modify `include/freetype/config/ftoption.h'
|
||||
to control how the FreeType library gets built. Normally, you don't
|
||||
need to change anything.
|
||||
|
||||
Applications have very limited control over FreeType's behaviour at
|
||||
run-time; look at the documentation of function `FT_Property_Set'.
|
||||
|
||||
|
||||
II. Normal installation and upgrades
|
||||
====================================
|
||||
|
||||
1. Unix and Unix-like systems
|
||||
|
||||
This also includes MacOS, Cygwin, MinGW + MSYS, Mingw-w64 + MSYS2,
|
||||
and possibly other, similar environments.
|
||||
|
||||
Please read `INSTALL.UNIX' to install or upgrade FreeType 2 on a
|
||||
Unix system. Note that you *need* GNU Make for automatic
|
||||
compilation, since other make tools won't work (this includes BSD
|
||||
Make).
|
||||
|
||||
GNU Make VERSION 3.81 OR NEWER IS NEEDED!
|
||||
|
||||
[For `cmake' see below.]
|
||||
|
||||
|
||||
2. On VMS with the `mms' build tool
|
||||
|
||||
See `INSTALL.VMS' for installation instructions on this platform.
|
||||
|
||||
|
||||
3. Other systems using GNU Make
|
||||
|
||||
On some non-Unix platforms, it is possible to build the library
|
||||
using only the GNU Make utility. Note that *NO OTHER MAKE TOOL
|
||||
WILL WORK*[1]! This methods supports several compilers on
|
||||
Windows, OS/2, and BeOS, including MinGW* (without MSYS*), Visual
|
||||
C++, Borland C++, and more.
|
||||
|
||||
Instructions are provided in the file `INSTALL.GNU'.
|
||||
|
||||
|
||||
4. With an IDE Project File (e.g., for Visual Studio or CodeWarrior)
|
||||
|
||||
We provide a small number of `project files' for various IDEs to
|
||||
automatically build the library as well. Note that these files
|
||||
are not supported and only sporadically maintained by FreeType
|
||||
developers, so don't expect them to work in each release.
|
||||
|
||||
To find them, have a look at the content of the `builds/<system>'
|
||||
directory, where <system> stands for your OS or environment.
|
||||
|
||||
|
||||
5. Using cmake
|
||||
|
||||
See the top-level `CMakeLists.txt' file for more information.
|
||||
|
||||
|
||||
6. From you own IDE, or own Makefiles
|
||||
|
||||
If you want to create your own project file, follow the
|
||||
instructions given in the `INSTALL.ANY' document of this
|
||||
directory.
|
||||
|
||||
|
||||
III. Custom builds of the library
|
||||
=================================
|
||||
|
||||
Customizing the compilation of FreeType is easy, and allows you to
|
||||
select only the components of the font engine that you really need.
|
||||
For more details read the file `CUSTOMIZE'.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
[1] make++, a make tool written in Perl, has sufficient support of GNU
|
||||
make extensions to build FreeType. See
|
||||
|
||||
https://makepp.sourceforge.net
|
||||
|
||||
for more information; you need version 2.0 or newer, and you must
|
||||
pass option `--norc-substitution'.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2000-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of INSTALL ---
|
|
@ -1,157 +0,0 @@
|
|||
Instructions on how to build FreeType with your own build tool
|
||||
==============================================================
|
||||
|
||||
See the file `CUSTOMIZE' to learn how to customize FreeType to
|
||||
specific environments.
|
||||
|
||||
|
||||
I. Standard procedure
|
||||
---------------------
|
||||
|
||||
* If you use macro names for FreeType header files (while mandatory
|
||||
in earlier versions, this is now optional since FreeType version
|
||||
2.6.1) it is necessary to disable pre-compiled headers. This is
|
||||
very important for Visual C++, because lines like
|
||||
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
are not correctly supported by this compiler while being ISO C
|
||||
compliant!
|
||||
|
||||
* You need to add the directory `include' to your include path when
|
||||
compiling the library.
|
||||
|
||||
* FreeType 2 is made of several components; each of them is located
|
||||
in a subdirectory of `freetype/src'. For example,
|
||||
`freetype/src/truetype/' contains the TrueType font driver.
|
||||
|
||||
* DO NOT COMPILE ALL C FILES! Rather, compile the following ones.
|
||||
|
||||
-- base components (required)
|
||||
|
||||
src/base/ftsystem.c
|
||||
src/base/ftinit.c
|
||||
src/base/ftdebug.c
|
||||
|
||||
src/base/ftbase.c
|
||||
|
||||
src/base/ftbbox.c -- recommended, see <ftbbox.h>
|
||||
src/base/ftglyph.c -- recommended, see <ftglyph.h>
|
||||
|
||||
src/base/ftbdf.c -- optional, see <ftbdf.h>
|
||||
src/base/ftbitmap.c -- optional, see <ftbitmap.h>
|
||||
src/base/ftcid.c -- optional, see <ftcid.h>
|
||||
src/base/ftfstype.c -- optional
|
||||
src/base/ftgasp.c -- optional, see <ftgasp.h>
|
||||
src/base/ftgxval.c -- optional, see <ftgxval.h>
|
||||
src/base/ftmm.c -- optional, see <ftmm.h>
|
||||
src/base/ftotval.c -- optional, see <ftotval.h>
|
||||
src/base/ftpatent.c -- optional
|
||||
src/base/ftpfr.c -- optional, see <ftpfr.h>
|
||||
src/base/ftstroke.c -- optional, see <ftstroke.h>
|
||||
src/base/ftsynth.c -- optional, see <ftsynth.h>
|
||||
src/base/fttype1.c -- optional, see <t1tables.h>
|
||||
src/base/ftwinfnt.c -- optional, see <ftwinfnt.h>
|
||||
|
||||
src/base/ftmac.c -- only on the Macintosh
|
||||
|
||||
-- font drivers (optional; at least one is needed)
|
||||
|
||||
src/bdf/bdf.c -- BDF font driver
|
||||
src/cff/cff.c -- CFF/OpenType font driver
|
||||
src/cid/type1cid.c -- Type 1 CID-keyed font driver
|
||||
src/pcf/pcf.c -- PCF font driver
|
||||
src/pfr/pfr.c -- PFR/TrueDoc font driver
|
||||
src/sfnt/sfnt.c -- SFNT files support
|
||||
(TrueType & OpenType)
|
||||
src/truetype/truetype.c -- TrueType font driver
|
||||
src/type1/type1.c -- Type 1 font driver
|
||||
src/type42/type42.c -- Type 42 font driver
|
||||
src/winfonts/winfnt.c -- Windows FONT / FNT font driver
|
||||
|
||||
-- rasterizers (optional; at least one is needed for vector
|
||||
formats)
|
||||
|
||||
src/raster/raster.c -- monochrome rasterizer
|
||||
src/sdf/sdf.c -- Signed Distance Field driver
|
||||
src/smooth/smooth.c -- anti-aliasing rasterizer
|
||||
|
||||
-- auxiliary modules (optional)
|
||||
|
||||
src/autofit/autofit.c -- auto hinting module
|
||||
src/cache/ftcache.c -- cache sub-system (in beta)
|
||||
src/gzip/ftgzip.c -- support for compressed fonts (.gz)
|
||||
src/lzw/ftlzw.c -- support for compressed fonts (.Z)
|
||||
src/bzip2/ftbzip2.c -- support for compressed fonts (.bz2)
|
||||
src/gxvalid/gxvalid.c -- TrueTypeGX/AAT table validation
|
||||
src/otvalid/otvalid.c -- OpenType table validation
|
||||
src/psaux/psaux.c -- PostScript Type 1 parsing
|
||||
src/pshinter/pshinter.c -- PS hinting module
|
||||
src/psnames/psnames.c -- PostScript glyph names support
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
`ftcache.c' needs `ftglyph.c'
|
||||
`ftfstype.c' needs `fttype1.c'
|
||||
`ftglyph.c' needs `ftbitmap.c'
|
||||
`ftstroke.c' needs `ftglyph.c'
|
||||
`ftsynth.c' needs `ftbitmap.c'
|
||||
|
||||
`cff.c' needs `sfnt.c', `pshinter.c', and `psnames.c'
|
||||
`truetype.c' needs `sfnt.c' and `psnames.c'
|
||||
`type1.c' needs `psaux.c' `pshinter.c', and `psnames.c'
|
||||
`type1cid.c' needs `psaux.c', `pshinter.c', and `psnames.c'
|
||||
`type42.c' needs `truetype.c'
|
||||
|
||||
Please consult the central `include/freetype/config/ftoption.h'
|
||||
configuration file for details on additional libraries necessary
|
||||
for some optional features.
|
||||
|
||||
|
||||
Read the file `CUSTOMIZE' in case you want to compile only a subset
|
||||
of the drivers, renderers, and optional modules; a detailed
|
||||
description of the various base extension is given in the top-level
|
||||
file `modules.cfg'.
|
||||
|
||||
You are done. In case of problems, see the archives of the FreeType
|
||||
development mailing list.
|
||||
|
||||
|
||||
II. Support for flat-directory compilation
|
||||
------------------------------------------
|
||||
|
||||
It is possible to put all FreeType 2 source files into a single
|
||||
directory, with the *exception* of the `include' hierarchy.
|
||||
|
||||
1. Copy all files in current directory
|
||||
|
||||
cp freetype/src/base/*.[hc] .
|
||||
cp freetype/src/raster1/*.[hc] .
|
||||
cp freetype/src/smooth/*.[hc] .
|
||||
etc.
|
||||
|
||||
2. Compile sources
|
||||
|
||||
cc -c -Iinclude -DFT2_BUILD_LIBRARY ftsystem.c
|
||||
cc -c -Iinclude -DFT2_BUILD_LIBRARY ftinit.c
|
||||
cc -c -Iinclude -DFT2_BUILD_LIBRARY ftdebug.c
|
||||
cc -c -Iinclude -DFT2_BUILD_LIBRARY ftbase.c
|
||||
etc.
|
||||
|
||||
You don't need to define the FT_FLAT_COMPILATION macro (as this
|
||||
was required in previous releases of FreeType 2).
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2003-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of INSTALL.ANY ---
|
|
@ -1,177 +0,0 @@
|
|||
This document contains instructions on how to cross-build the FreeType
|
||||
library on Unix systems, for example, building binaries for Linux/MIPS
|
||||
on FreeBSD/i386. Before reading this document, please consult the
|
||||
file `INSTALL.UNIX' for required tools and the basic self-building
|
||||
procedure.
|
||||
|
||||
|
||||
1. Required Tools
|
||||
-----------------
|
||||
|
||||
For self-building the FreeType library on a Unix system, GNU Make
|
||||
3.81 or newer is required. `INSTALL.UNIX' contains hints how to
|
||||
check the installed `make'.
|
||||
|
||||
The GNU C compiler to cross-build the target system is required.
|
||||
Currently, using a non-GNU cross compiler is untested. The cross
|
||||
compiler is expected to be installed with a system prefix. For
|
||||
example, if your building system is FreeBSD/i386 and the target
|
||||
system is Linux/MIPS, the cross compiler should be installed with
|
||||
the name `mips-ip22-linuxelf-gcc'.
|
||||
|
||||
A C compiler for a self-build is required also, to build a tool
|
||||
(`apinames') that is executed during the build procedure. Non-GNU
|
||||
self compilers are acceptable, but such a setup is untested.
|
||||
|
||||
|
||||
2. Configuration
|
||||
----------------
|
||||
|
||||
2.1. Building and target system
|
||||
|
||||
To configure a cross-build, the options `--host=<system>' and
|
||||
`--build=<system>' must be passed to the `configure' script.
|
||||
For example, if your build system is FreeBSD/i386 and the target
|
||||
system is Linux/MIPS, say
|
||||
|
||||
./configure \
|
||||
--build=i386-unknown-freebsd \
|
||||
--host=mips-ip22-linuxelf \
|
||||
[other options]
|
||||
|
||||
It should be noted that `--host=<system>' specifies the system
|
||||
where the built binaries will be executed, not the system where
|
||||
the build actually happens. Older versions of GNU autoconf use
|
||||
the option pair `--host=' and `--target='. This is broken and
|
||||
doesn't work. Similarly, an explicit CC specification like
|
||||
|
||||
env CC=mips-ip22-linux-gcc ./configure # BAD
|
||||
|
||||
or
|
||||
|
||||
env CC=/usr/local/mips-ip22-linux/bin/gcc ./configure # BAD
|
||||
|
||||
doesn't work either; such a configuration confuses the
|
||||
`configure' script while trying to find the cross and native C
|
||||
compilers.
|
||||
|
||||
|
||||
2.2. The prefix to install FreeType2
|
||||
|
||||
Setting `--prefix=<prefix>' properly is important. The prefix
|
||||
to install FreeType2 is written into the `freetype-config'
|
||||
script and `freetype2.pc' configuration file.
|
||||
|
||||
If the built FreeType 2 library is used as a part of the
|
||||
cross-building system, the prefix is expected to be different
|
||||
from the self-building system. For example, a configuration
|
||||
with `--prefix=/usr/local' installs binaries into the
|
||||
system-wide `/usr/local' directory, which then can't be executed
|
||||
due to the incorrect architecture. This causes confusion in
|
||||
configuration of all applications that use FreeType2. Instead,
|
||||
use a prefix to install the cross-build into a separate system
|
||||
tree, for example, `--prefix=/usr/local/mips-ip22-linux/'.
|
||||
|
||||
On the other hand, if the built FreeType 2 library is used as a
|
||||
part of the target system, the prefix to install should reflect
|
||||
the file system structure of the target system.
|
||||
|
||||
|
||||
2.3. Library dependencies
|
||||
|
||||
FreeType normally depends on external libraries like `libpng' or
|
||||
`libharfbuzz'. The easiest case is to deactivate all such
|
||||
dependencies using the `--without-XXX' configuration options.
|
||||
However, if you want to use those libraries, you should ensure
|
||||
that they are available both on the target system and as
|
||||
(cross-compiled) libraries on the build system.
|
||||
|
||||
FreeType uses `pkg-config' to find most of the libraries; the
|
||||
other libraries it links to are expected in the standard system
|
||||
directories. Since the default pkg-config's meta-information
|
||||
files (like `harfbuzz.pc') of the build platform don't work, use
|
||||
one of the two possible solutions below.
|
||||
|
||||
o Use pkg-config's meta-information files that are adjusted to
|
||||
cross-compile and cross-link with the target platform's
|
||||
libraries. Make sure those files are found before the build
|
||||
system's default files. Example:
|
||||
|
||||
./configure \
|
||||
--build=i386-unknown-freebsd \
|
||||
--host=mips-ip22-linuxelf \
|
||||
PKG_CONFIG_LIBDIR="/usr/local/mips-ip22-linux/lib/pkgconfig" \
|
||||
[other options]
|
||||
|
||||
See the manpage of `pkg-config' for more details.
|
||||
|
||||
o Set variables like LIBPNG_LIBS as additional options to the
|
||||
`configure' script, overriding the values `pkg-config' would
|
||||
provide. `configure --help' shows the available environment
|
||||
variables. Example:
|
||||
|
||||
./configure \
|
||||
--build=i386-unknown-freebsd \
|
||||
--host=mips-ip22-linuxelf \
|
||||
LIBPNG_CFLAGS="-I/usr/local/mips-ip22-linux/include" \
|
||||
LIBPNG_LIBS="-L/usr/local/mips-ip22-linux/lib -lpng12" \
|
||||
[other options]
|
||||
|
||||
|
||||
3. Building command
|
||||
-------------------
|
||||
|
||||
If the configuration finishes successfully, invoking GNU make
|
||||
builds FreeType2. Just say
|
||||
|
||||
make
|
||||
|
||||
or
|
||||
|
||||
gmake
|
||||
|
||||
depending on the name the GNU make binary actually has.
|
||||
|
||||
|
||||
4. Installation
|
||||
---------------
|
||||
|
||||
Saying
|
||||
|
||||
make install
|
||||
|
||||
as usual to install FreeType2 into the directory tree specified by
|
||||
the argument of the `--prefix' option.
|
||||
|
||||
As noted in section 2.2, FreeType2 is sometimes configured to be
|
||||
installed into the system directory of the target system, and
|
||||
should not be installed in the cross-building system. In such
|
||||
cases, the make variable `DESTDIR' is useful to change the root
|
||||
directory in the installation. For example, after
|
||||
|
||||
make DESTDIR=/mnt/target_system_root/ install
|
||||
|
||||
the built FreeType2 library files are installed into the directory
|
||||
`/mnt/target_system_root/<prefix_in_configure>/lib'.
|
||||
|
||||
|
||||
5. TODO
|
||||
-------
|
||||
|
||||
Cross building between Cygwin (or MSys) and Unix must be tested.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2006-2021 by
|
||||
suzuki toshiya, David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of INSTALL.CROSS ---
|
|
@ -1,181 +0,0 @@
|
|||
This document contains instructions how to build the FreeType library
|
||||
on non-Unix systems with the help of GNU Make. Note that if you are
|
||||
running Cygwin or MinGW/MSYS in Windows, you should follow the
|
||||
instructions in the file `INSTALL.UNIX' instead.
|
||||
|
||||
|
||||
FreeType 2 includes a powerful and flexible build system that allows
|
||||
you to easily compile it on a great variety of platforms from the
|
||||
command line. To do so, just follow these simple instructions.
|
||||
|
||||
1. Install GNU Make
|
||||
-------------------
|
||||
|
||||
The FreeType 2 build system relies on many features special to GNU
|
||||
Make.
|
||||
|
||||
NEARLY ALL OTHER MAKE TOOLS FAIL, INCLUDING `BSD MAKE', SO REALLY
|
||||
INSTALL A RECENT VERSION OF GNU MAKE ON YOUR SYSTEM!
|
||||
|
||||
Note that make++, a make tool written in Perl, supports enough
|
||||
features of GNU make to compile FreeType. See
|
||||
|
||||
https://makepp.sourceforge.net
|
||||
|
||||
for more information; you need version 2.0 or newer, and you must
|
||||
pass option `--norc-substitution'.
|
||||
|
||||
Make sure that you are invoking GNU Make from the command line, by
|
||||
typing something like:
|
||||
|
||||
make -v
|
||||
|
||||
to display its version number.
|
||||
|
||||
VERSION 3.81 OR NEWER IS NEEDED!
|
||||
|
||||
|
||||
2. Invoke `make'
|
||||
----------------
|
||||
|
||||
Go to the root directory of FreeType 2, then simply invoke GNU
|
||||
Make from the command line. This will launch the FreeType 2 host
|
||||
platform detection routines. A summary will be displayed, for
|
||||
example, on Win32.
|
||||
|
||||
|
||||
==============================================================
|
||||
FreeType build system -- automatic system detection
|
||||
|
||||
The following settings are used:
|
||||
|
||||
platform windows
|
||||
compiler gcc
|
||||
configuration directory .\builds\windows
|
||||
configuration rules .\builds\windows\w32-gcc.mk
|
||||
|
||||
If this does not correspond to your system or settings please
|
||||
remove the file 'config.mk' from this directory then read the
|
||||
INSTALL file for help.
|
||||
|
||||
Otherwise, simply type 'make' again to build the library
|
||||
or 'make refdoc' to build the API reference (the latter needs
|
||||
Python >= 3.5).
|
||||
=============================================================
|
||||
|
||||
|
||||
If the detected settings correspond to your platform and compiler,
|
||||
skip to step 5. Note that if your platform is completely alien to
|
||||
the build system, the detected platform will be `ansi'.
|
||||
|
||||
|
||||
3. Configure the build system for a different compiler
|
||||
------------------------------------------------------
|
||||
|
||||
If the build system correctly detected your platform, but you want
|
||||
to use a different compiler than the one specified in the summary
|
||||
(for most platforms, gcc is the default compiler), invoke GNU Make
|
||||
with
|
||||
|
||||
make setup <compiler>
|
||||
|
||||
Examples:
|
||||
|
||||
to use Visual C++ on Win32, type: `make setup visualc'
|
||||
to use Borland C++ on Win32, type `make setup bcc32'
|
||||
to use Watcom C++ on Win32, type `make setup watcom'
|
||||
to use Intel C++ on Win32, type `make setup intelc'
|
||||
to use LCC-Win32 on Win32, type: `make setup lcc'
|
||||
to use Watcom C++ on OS/2, type `make setup watcom'
|
||||
to use VisualAge C++ on OS/2, type `make setup visualage'
|
||||
|
||||
The <compiler> name to use is platform-dependent. The list of
|
||||
available compilers for your system is available in the file
|
||||
`builds/<system>/detect.mk'.
|
||||
|
||||
If you are satisfied by the new configuration summary, skip to
|
||||
step 5.
|
||||
|
||||
|
||||
3a. Use clang instead of gcc
|
||||
----------------------------
|
||||
|
||||
The `clang' compiler can use FreeType's setup for `gcc'; it is
|
||||
sufficient to set the `CC' variable, for example
|
||||
|
||||
make CC=clang
|
||||
|
||||
|
||||
3b. Compiling with a C++ compiler
|
||||
---------------------------------
|
||||
|
||||
FreeType can be built with a C++ compiler, for example
|
||||
|
||||
make CC="g++"
|
||||
|
||||
If `clang++' should be used it is necessary to also override the
|
||||
`ANSIFLAGS' variable:
|
||||
|
||||
make CC="clang++" ANSIFLAGS=""
|
||||
|
||||
|
||||
4. Configure the build system for an unknown platform/compiler
|
||||
--------------------------------------------------------------
|
||||
|
||||
The auto-detection/setup phase of the build system copies a file
|
||||
to the current directory under the name `config.mk'.
|
||||
|
||||
For example, on OS/2+gcc, it would simply copy
|
||||
`builds/os2/os2-gcc.mk' to `./config.mk'.
|
||||
|
||||
If for some reason your platform isn't correctly detected, copy
|
||||
manually the configuration sub-makefile to `./config.mk' and go to
|
||||
step 5.
|
||||
|
||||
Note that this file is a sub-Makefile used to specify Make
|
||||
variables for compiler and linker invocation during the build.
|
||||
You can easily create your own version from one of the existing
|
||||
configuration files, then copy it to the current directory under
|
||||
the name `./config.mk'.
|
||||
|
||||
|
||||
5. Build the library
|
||||
--------------------
|
||||
|
||||
The auto-detection/setup phase should have copied a file in the
|
||||
current directory, called `./config.mk'. This file contains
|
||||
definitions of various Make variables used to invoke the compiler
|
||||
and linker during the build. [It has also generated a file called
|
||||
`ftmodule.h' in the objects directory (which is normally
|
||||
`<toplevel>/objs/'); please read the file `docs/CUSTOMIZE' for
|
||||
customization of FreeType.]
|
||||
|
||||
To launch the build, simply invoke GNU Make again: The top
|
||||
Makefile will detect the configuration file and run the build with
|
||||
it. If you have used variables in step 3, you must use the same
|
||||
variables here, too.
|
||||
|
||||
|
||||
Final note
|
||||
|
||||
The above instructions build a _statically_ linked library of the
|
||||
font engine in the `objs' directory. On Windows, you can build a
|
||||
DLL either with MinGW (within an MSYS shell, following the
|
||||
instructions in `INSTALL.UNIX'), or you use one of the Visual C++
|
||||
project files; see the subdirectories of `builds/windows'. For
|
||||
everything else, you are on your own, and you might follow the
|
||||
instructions in `INSTALL.ANY' to create your own Makefiles.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2003-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of INSTALL.GNU ---
|
|
@ -1,32 +0,0 @@
|
|||
Please follow the instructions in INSTALL.UNIX to install FreeType on
|
||||
Mac OS X.
|
||||
|
||||
Currently FreeType2 functions based on some deprecated Carbon APIs
|
||||
return `FT_Err_Unimplemented_Feature' always, even if FreeType2 is
|
||||
configured and built on the system that deprecated Carbon APIs are
|
||||
available. To enable deprecated FreeType2 functions as far as
|
||||
possible, replace `src/base/ftmac.c' by `builds/mac/ftmac.c'.
|
||||
|
||||
Starting with Mac OS X 10.5, gcc defaults the deployment target to
|
||||
10.5. In previous versions of Mac OS X, this defaulted to 10.1. If
|
||||
you want your built binaries to run only on 10.5, this change does not
|
||||
concern you. If you want them to also run on older versions of Mac
|
||||
OS X, then you must either set the MACOSX_DEPLOYMENT_TARGET
|
||||
environment variable or pass `-mmacosx-version-min' to gcc. You
|
||||
should specify the oldest version of Mac OS you want the code to run
|
||||
on. For example, if you use Bourne shell:
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.2
|
||||
|
||||
or, if you use C shell:
|
||||
|
||||
setenv MACOSX_DEPLOYMENT_TARGET 10.2
|
||||
|
||||
Alternatively, you could pass `-mmacosx-version-min=10.2' to gcc.
|
||||
|
||||
Here the number 10.2 is the lowest version that the built binaries can
|
||||
run on. In the above cases, the built binaries will run on Mac OS X
|
||||
10.2 and later, but _not_ earlier. If you want to run on earlier, you
|
||||
have to set lower version, e.g., 10.0.
|
||||
|
||||
For classic Mac OS (Mac OS 7, 8, 9) please refer to builds/mac/README.
|
|
@ -1,139 +0,0 @@
|
|||
This document contains instructions on how to build the FreeType
|
||||
library on Unix systems. This also works for emulations like Cygwin
|
||||
or MSys on Win32:
|
||||
|
||||
|
||||
1. Ensure that you are using GNU Make
|
||||
-------------------------------------
|
||||
|
||||
The FreeType build system _exclusively_ works with GNU Make. You
|
||||
will not be able to compile the library with the instructions
|
||||
below using any other alternative (including BSD Make).
|
||||
|
||||
Check that you have GNU make by running the command:
|
||||
|
||||
make -v
|
||||
|
||||
This should dump some text that begins with:
|
||||
|
||||
GNU Make <version number>
|
||||
Copyright (C) <year> Free Software Foundation Inc.
|
||||
|
||||
Note that version 3.81 or higher is *required* or the build will
|
||||
fail.
|
||||
|
||||
It is also fine to have GNU Make under another name (e.g. 'gmake')
|
||||
if you use the MAKE variable as described below.
|
||||
|
||||
As a special exception, 'makepp' can also be used to build
|
||||
FreeType 2. See the file docs/MAKEPP for details.
|
||||
|
||||
For builds with `cmake' please check file `CMakeLists.txt'; this
|
||||
is a contributed file not directly supported by the FreeType team.
|
||||
|
||||
|
||||
2. Regenerate the configure script if needed
|
||||
--------------------------------------------
|
||||
|
||||
This only applies if you are building a git snapshot or checkout,
|
||||
*not* if you grabbed the sources of an official release.
|
||||
|
||||
You need to invoke the `autogen.sh' script in the top-level
|
||||
directory in order to create the `configure' script for your
|
||||
platform. Normally, this simply means typing:
|
||||
|
||||
sh autogen.sh
|
||||
|
||||
In case of problems, you may need to install or upgrade Automake,
|
||||
Autoconf or Libtool. See `README.git' in the top-level directory
|
||||
for more information.
|
||||
|
||||
|
||||
3. Build and install the library
|
||||
--------------------------------
|
||||
|
||||
Say
|
||||
|
||||
./configure --help
|
||||
|
||||
to see the list of possible configuration options and important
|
||||
environment variables. The ./configure script will detect some
|
||||
prerequisite system libraries (libpng, brotli, etc.) if their
|
||||
headers are available at the default locations.
|
||||
|
||||
The following should work on all Unix systems where the `make'
|
||||
command invokes GNU Make:
|
||||
|
||||
./configure [options]
|
||||
make
|
||||
make install (as root)
|
||||
|
||||
The default installation path is `/usr/local'. It can be changed
|
||||
with the `--prefix=<path>' option. Example:
|
||||
|
||||
./configure --prefix=/usr
|
||||
|
||||
When using a different command to invoke GNU Make, use the MAKE
|
||||
variable. For example, if `gmake' is the command to use on your
|
||||
system, do something like:
|
||||
|
||||
MAKE=gmake ./configure [options]
|
||||
gmake
|
||||
gmake install (as root)
|
||||
|
||||
If this still doesn't work, there must be a problem with your
|
||||
system (e.g., you are using a very old version of GNU Make).
|
||||
|
||||
For library identification, FreeType's `configure' script uses the
|
||||
`pkg-config' interface: Assuming it needs library `foo', it calls
|
||||
the `pkg-config' program to find information on library `foo',
|
||||
which in turn looks for a `foo.pc' file installed at the system.
|
||||
Some platforms, however, don't come with `pkg-support'; you then
|
||||
have to use environment variables as described by `configure
|
||||
--help'. Example:
|
||||
|
||||
LIBPNG_CFLAGS="-I/path/to/libpng/include/directory" \
|
||||
LIBPNG_LIBS="-L/path/to/libpng/lib/directory" \
|
||||
configure ...
|
||||
|
||||
It is possible to compile FreeType in a different directory.
|
||||
Assuming the FreeType source files in directory `/src/freetype' a
|
||||
compilation in directory `foo' works as follows:
|
||||
|
||||
cd foo
|
||||
/src/freetype/configure [options]
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
3.1 Interdependency with HarfBuzz
|
||||
.................................
|
||||
|
||||
Note that there is a chicken-and-egg problem currently since the
|
||||
HarfBuzz library (used by the auto-hinter to improve support of
|
||||
OpenType fonts) depends on FreeType, which can be solved as
|
||||
follows in case HarfBuzz is not yet installed on your system.
|
||||
|
||||
1. Call FreeType's `configure' script with option
|
||||
`--without-harfbuzz', then compile and install FreeType.
|
||||
|
||||
2. Compile and install HarfBuzz.
|
||||
|
||||
3. Call FreeType's `configure' script without option
|
||||
`--without-harfbuzz' (after executing `make distclean'), then
|
||||
compile and install FreeType again.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2003-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of INSTALL.UNIX ---
|
|
@ -1,62 +0,0 @@
|
|||
How to build the FreeType 2 library on VMS
|
||||
-----------------------------------------
|
||||
|
||||
It is actually very straightforward to install the FreeType 2 library.
|
||||
Just execute vms_make.com from the toplevel directory to build the
|
||||
library. This procedure currently accepts the following options:
|
||||
|
||||
DEBUG
|
||||
Build the library with debug information and without optimization.
|
||||
|
||||
lopts=<value>
|
||||
Options to pass to the link command e.g. lopts=/traceback
|
||||
|
||||
ccopt=<value>
|
||||
Options to pass to the C compiler e.g. ccopt=/float=ieee
|
||||
|
||||
In case you did download the demos, place them in a separate directory
|
||||
sharing the same top level as the directory of FreeType 2 and follow
|
||||
the same instructions as above for the demos from there. The build
|
||||
process relies on this to figure out the location of the FreeType 2
|
||||
include files.
|
||||
|
||||
|
||||
To rebuild the sources it is necessary to have MMS/MMK installed on
|
||||
the system.
|
||||
|
||||
The library is available in the directory
|
||||
|
||||
[.LIB]
|
||||
|
||||
To compile applications using FreeType 2 you have to define the
|
||||
logical FREETYPE pointing to the directory
|
||||
|
||||
[.INCLUDE.FREETYPE]
|
||||
|
||||
i.e., if the directory in which this INSTALL.VMS file is located is
|
||||
$disk:[freetype] then define the logical with
|
||||
|
||||
define freetype $disk:[freetype.include.freetype]
|
||||
|
||||
This version has been tested with Compaq C V6.2-006 on OpenVMS Alpha
|
||||
V7.2-1.
|
||||
|
||||
|
||||
Any problems can be reported to
|
||||
|
||||
Jouk Jansen <joukj@hrem.stm.tudelft.nl> or
|
||||
Martin P.J. Zinser <zinser@zinser.no-ip.info>
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2000-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute this
|
||||
file you indicate that you have read the license and understand and
|
||||
accept it fully.
|
||||
|
||||
|
||||
--- end of INSTALL.VMS ---
|
|
@ -1,5 +0,0 @@
|
|||
As a special exception, FreeType can also be built with the 'makepp'
|
||||
build tool, available from https://makepp.sourceforge.net.
|
||||
|
||||
Note, however, that you will need at least version 2.0 and pass the
|
||||
option --norc-substitution to have it work correctly.
|
|
@ -1,90 +0,0 @@
|
|||
This file describes various problems that have been encountered in
|
||||
compiling, installing and running FreeType 2. Suggestions for
|
||||
additions or other improvements to this file are welcome.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Running Problems
|
||||
================
|
||||
|
||||
|
||||
* Some Type 1, Multiple Masters, and CID-keyed PostScript fonts aren't
|
||||
handled correctly.
|
||||
|
||||
-----
|
||||
|
||||
Of course, there might be bugs in FreeType, but some fonts based on
|
||||
the PostScript format can't be handled indeed. The reason is that
|
||||
FreeType doesn't contain a full PostScript interpreter but applies
|
||||
pattern matching instead. In case a font doesn't follow the standard
|
||||
structure of the given font format, FreeType fails. A typical example
|
||||
is Adobe's `Optima' font family which contains extra code to switch
|
||||
between low and high resolution versions of the glyphs.
|
||||
|
||||
It might be possible to patch FreeType in some situations, though.
|
||||
Please report failing fonts so that we investigate the problem and set
|
||||
up a list of such problematic fonts.
|
||||
|
||||
|
||||
* Why do identical FreeType versions render differently on different
|
||||
platforms?
|
||||
|
||||
-----
|
||||
|
||||
Different distributions compile FreeType with different options. The
|
||||
developer version of a distribution's FreeType package, which is
|
||||
needed to compile your program against FreeType, includes the file
|
||||
ftoption.h. Compare each platform's copy of ftoption.h to find the
|
||||
differences.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
||||
Compilation Problems
|
||||
====================
|
||||
|
||||
|
||||
* I get an `internal compilation error' (ICE) while compiling FreeType
|
||||
2.2.1 with Intel C++.
|
||||
|
||||
This has been reported for the following compiler version:
|
||||
|
||||
Intel(R) C++ Compiler for 32-bit applications,
|
||||
Version 9.0 Build 20050430Z Package ID: W_CC_P_9.0.019
|
||||
|
||||
-----
|
||||
|
||||
The best solution is to update the compiler to version
|
||||
|
||||
Intel(R) C++ Compiler for 32-bit applications,
|
||||
Version 9.1 Build 20060323Z Package ID: W_CC_P_9.1.022
|
||||
|
||||
or newer. If this isn't feasible, apply the following patch.
|
||||
|
||||
|
||||
--- src/cache/ftcbasic.c 20 Mar 2006 12:10:24 -0000 1.20
|
||||
+++ src/cache/ftcbasic.c.patched 15 May 2006 02:51:02 -0000
|
||||
@@ -252,7 +252,7 @@
|
||||
*/
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
- const FTC_IFamilyClassRec ftc_basic_image_family_class =
|
||||
+ FTC_IFamilyClassRec ftc_basic_image_family_class =
|
||||
{
|
||||
{
|
||||
sizeof ( FTC_BasicFamilyRec ),
|
||||
@@ -266,7 +266,7 @@
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
- const FTC_GCacheClassRec ftc_basic_image_cache_class =
|
||||
+ FTC_GCacheClassRec ftc_basic_image_cache_class =
|
||||
{
|
||||
{
|
||||
ftc_inode_new,
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
--- end of PROBLEMS ---
|
|
@ -1,35 +0,0 @@
|
|||
After saying `make refdoc' or `make refdoc-venv' the `reference/' directory
|
||||
contains the FreeType API reference. You need Python >= 3.5 and pip to make
|
||||
this target.
|
||||
|
||||
There are two ways to generate the documentation:
|
||||
|
||||
1. Using `make refdoc':
|
||||
|
||||
- Ensure `python' and `pip' are available.
|
||||
- Install pip package `docwriter' with `pip install --user docwriter'.
|
||||
- Make target with `make refdoc'.
|
||||
- This target can be run offline once required packages are installed.
|
||||
|
||||
2. Using `make refdoc-venv' (requires internet access):
|
||||
|
||||
- Ensure `python', `pip' and Python package `virtualenv' are available.
|
||||
- Make target with `make refdoc-venv'.
|
||||
- This may or may not require internet access every time depending on
|
||||
pip and system caching.
|
||||
|
||||
This also works with Jam: Just type `jam refdoc' in the main directory.
|
||||
|
||||
Some troubleshooting tips:
|
||||
|
||||
* Regularly run `pip install --upgrade docwriter' to check for updates which
|
||||
may include bug fixes.
|
||||
|
||||
* `Docwriter' does not support Python 2. Ensure that Python >= 3.5 is
|
||||
installed and available as `python3'/`python'.
|
||||
|
||||
* Ensure that `docwriter' is installed in the same Python target that
|
||||
`make refdoc' uses (python3/python).
|
||||
|
||||
* If none of this works, send a mail to `freetype-devel@nongnu.org' or file
|
||||
an issue at `https://github.com/freetype/docwriter/issues'.
|
|
@ -1,40 +0,0 @@
|
|||
Here is a list of items that need to be addressed in FreeType 2
|
||||
---------------------------------------------------------------
|
||||
|
||||
* Implement stem3/counter hints properly in the Postscript hinter.
|
||||
|
||||
* Add CIDCMap support to the CID driver.
|
||||
|
||||
* Add track kerning support to the PFR driver.
|
||||
|
||||
* Add kerning (AFM file) support to the CID driver.
|
||||
|
||||
|
||||
Here is a list of bugs which should be handled
|
||||
----------------------------------------------
|
||||
|
||||
Other bugs have been registered at the savannah bugzilla of FreeType.
|
||||
|
||||
* CID driver:
|
||||
Handle the case where a CID font has a top-level font matrix also
|
||||
(see PLRM, 5.11.3, Type 0 CIDFonts). Since CID_FaceInfoRec lacks
|
||||
a font_matrix entry we have to directly apply it to all subfont
|
||||
matrices.
|
||||
|
||||
* CID driver:
|
||||
Use top-level font matrix entry for setting the upem value, not the
|
||||
entries in the FDarray. If absent, use 1000.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2001-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute this
|
||||
file you indicate that you have read the license and understand and
|
||||
accept it fully.
|
||||
|
||||
|
||||
--- end of TODO ---
|
|
@ -1,131 +0,0 @@
|
|||
Due to our use of `libtool' to generate and install the FreeType 2
|
||||
libraries on Unix systems, as well as other historical events, it is
|
||||
generally very difficult to know precisely which release of the font
|
||||
engine is installed on a given system.
|
||||
|
||||
This file tries to explain why and to document ways to properly detect
|
||||
FreeType on Unix.
|
||||
|
||||
|
||||
1. Version and Release numbers
|
||||
------------------------------
|
||||
|
||||
For each new public release of FreeType 2, there are generally *three*
|
||||
distinct `version' numbers to consider:
|
||||
|
||||
* The official FreeType 2 release number, like 2.7.0 or 2.10.2.
|
||||
|
||||
* The libtool (and Unix) specific version number, like 23.2.17.
|
||||
This is what
|
||||
|
||||
pkg-config freetype2 --modversion
|
||||
|
||||
or
|
||||
|
||||
freetype-config --version
|
||||
|
||||
returns.
|
||||
|
||||
* The platform-specific shared object number, used for example when
|
||||
the library is installed as `/usr/lib/libfreetype.so.6.17.2'.
|
||||
|
||||
The platform-specific number is, unsurprisingly, platform-specific and
|
||||
varies with the operating system you are using (several variants of
|
||||
Linux, FreeBSD, Solaris, etc.). You should thus _never_ use it, even
|
||||
for simple tests.
|
||||
|
||||
The libtool-specific number does not equal the release number but is
|
||||
tied to it.
|
||||
|
||||
The release number is available at *compile* time through the
|
||||
following macros defined in `freetype.h':
|
||||
|
||||
- FREETYPE_MAJOR: major release number
|
||||
- FREETYPE_MINOR: minor release number
|
||||
- FREETYPE_PATCH: patch release number
|
||||
|
||||
See below for a small autoconf fragment.
|
||||
|
||||
The release number is also available at *runtime* through the
|
||||
`FT_Library_Version' API.
|
||||
|
||||
|
||||
2. History
|
||||
----------
|
||||
|
||||
The following table gives, for all releases since 2.5.0, the
|
||||
corresponding libtool number, as well as the shared object number
|
||||
found on _most_ systems, but not all of them:
|
||||
|
||||
|
||||
release libtool so
|
||||
-------------------------------
|
||||
2.11.0 24.0.18 6.18.0
|
||||
2.10.4 23.4.17 6.17.4
|
||||
2.10.3 23.3.17 6.17.3
|
||||
2.10.2 23.2.17 6.17.2
|
||||
2.10.1 23.1.17 6.17.1
|
||||
2.10.0 23.0.17 6.17.0
|
||||
2.9.1 22.1.16 6.16.1
|
||||
2.9.0 22.0.16 6.16.0
|
||||
2.8.1 21.0.15 6.15.0
|
||||
2.8.0 20.0.14 6.14.0
|
||||
2.7.1 19.0.13 6.13.0
|
||||
2.7.0 18.6.12 6.12.6
|
||||
2.6.5 18.5.12 6.12.5
|
||||
2.6.4 18.4.12 6.12.4
|
||||
2.6.3 18.3.12 6.12.3
|
||||
2.6.2 18.2.12 6.12.2
|
||||
2.6.1 18.1.12 6.12.1
|
||||
2.6.0 18.0.12 6.12.0
|
||||
2.5.5 17.4.11 6.11.4
|
||||
2.5.4 17.3.11 6.11.3
|
||||
2.5.3 17.2.11 6.11.2
|
||||
2.5.2 17.1.11 6.11.1
|
||||
2.5.1 17.0.11 6.11.0
|
||||
2.5.0 16.2.10 6.10.2
|
||||
|
||||
|
||||
3. Autoconf Code Fragment
|
||||
-------------------------
|
||||
|
||||
Lars Clausen contributed the following autoconf fragment to check
|
||||
which version of FreeType is installed on a system (now updated to use
|
||||
`pkg-config' instead of `freetype-config'). This one tests for a
|
||||
version that is at least 2.10.2; you should change it to check against
|
||||
other release numbers.
|
||||
|
||||
|
||||
AC_MSG_CHECKING([whether FreeType version is 2.10.2 or higher])
|
||||
old_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS=`pkg-config freetype2 --cflags`
|
||||
AC_TRY_CPP([
|
||||
|
||||
#include <ft2build.h>
|
||||
#include <freetype/freetype.h>
|
||||
|
||||
#if FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH < 21002
|
||||
# error FreeType version too low.
|
||||
#endif
|
||||
|
||||
],
|
||||
[AC_MSG_RESULT(yes)
|
||||
FREETYPE_LIBS=`pkg-config freetype2 --libs`
|
||||
AC_SUBST(FREETYPE_LIBS)
|
||||
AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
|
||||
CPPFLAGS="$old_CPPFLAGS"],
|
||||
[AC_MSG_ERROR([Need FreeType library version 2.10.2 or higher])])
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2002-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
this file you indicate that you have read the license and understand
|
||||
and accept it fully.
|
||||
|
||||
|
||||
--- end of VERSIONS.TXT ---
|
|
@ -1,208 +0,0 @@
|
|||
This file contains a list of various font formats. It gives the
|
||||
reference document and whether it is supported in FreeType 2.
|
||||
|
||||
Table fields
|
||||
------------
|
||||
|
||||
wrapper format
|
||||
The format used to represent the font data. In the table below it
|
||||
is used only if the font format differs. Possible values are
|
||||
|
||||
SFNT binary
|
||||
PFB binary
|
||||
PS a text header, followed by binary or text data
|
||||
LZW compressed with either `gzip' or `compress'
|
||||
BZ2 compressed with `bzip2'.
|
||||
|
||||
font format
|
||||
How the font is to be accessed, possibly after converting the file
|
||||
type and wrapper format into a generic form. Bitmap formats are
|
||||
`BDF', `PCF', and one form of `WINFNT'; all others are vector
|
||||
formats. `PS' indicates third-order, `TT' second-order Bézier
|
||||
curves.
|
||||
|
||||
font type
|
||||
Sub-formats of the font format. `SBIT' and `MACSBIT' are bitmap
|
||||
formats, `MM' and `VAR' support optical axes. `CFF2' supports
|
||||
optical axes also.
|
||||
|
||||
glyph access
|
||||
If not specified, the glyph access is `standard' to the font
|
||||
format. Values are `CID' for CID-keyed fonts, `SYNTHETIC' for
|
||||
fonts that are modified versions of other fonts by means of a
|
||||
transformation matrix, and `TYPE_0' for PS fonts which are to be
|
||||
accessed in a tree-like structure.
|
||||
|
||||
FreeType driver
|
||||
The module in the FreeType library which handles the specific font
|
||||
format. A missing entry means that FreeType doesn't support the
|
||||
font format (yet).
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
The SFNT container format also provides `collections' (usually
|
||||
having the file extension `.ttc' or `.otc'). A collection contains
|
||||
multiple font faces that share some tables to avoid redundancy, thus
|
||||
reducing the file size. In FreeType, elements of a collection can
|
||||
be accessed with a proper face index.
|
||||
|
||||
Both the GX and the OpenType 1.8 variation fonts provide `named
|
||||
instances'. FreeType maps them to face indices (they can also be
|
||||
accessed with the standard MM interface).
|
||||
|
||||
Other font formats (not using the SFNT wrapper) also provide
|
||||
multiple faces within one file; they are marked with an asterisk
|
||||
(`*') in the table below.
|
||||
|
||||
FreeType can be configured to support Mac files (on older Mac OS
|
||||
versions, a `file' is stored as a data and a resource fork, this is,
|
||||
within two separate data chunks). If a file can't be opened as a
|
||||
font, FreeType then checks whether it is a resource fork, trying to
|
||||
extract the contained font data from either a `POST' or `sfnt'
|
||||
resource.
|
||||
|
||||
|
||||
Please send additions and/or corrections to wl@gnu.org or to the
|
||||
FreeType developer's list at freetype-devel@nongnu.org (for
|
||||
subscribers only). If you can provide a font example for a format
|
||||
which isn't supported yet please send a mail too.
|
||||
|
||||
|
||||
wrapper font font glyph FreeType reference
|
||||
format format type access driver documents
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
--- BDF --- --- bdf 5005.BDF_Spec.pdf, X11
|
||||
|
||||
|
||||
SFNT PS TYPE_1 --- type1 Type 1 GX Font Format
|
||||
(for the Mac) [3]
|
||||
SFNT PS TYPE_1 CID cid 5180.sfnt.pdf (for the Mac)
|
||||
[3]
|
||||
SFNT PS CFF --- cff OT spec, 5176.CFF.pdf
|
||||
(`OTTO' format)
|
||||
SFNT PS CFF CID cff OT spec, 5176.CFF.pdf
|
||||
SFNT PS CFF SYNTHETIC --- OT spec, 5176.CFF.pdf
|
||||
SFNT PS CFF2 --- cff OT spec 1.8
|
||||
|
||||
SFNT TT SBIT --- sfnt XFree86 (bitmaps only;
|
||||
with `head' table)
|
||||
SFNT TT MACSBIT --- sfnt OT spec (for the Mac;
|
||||
bitmaps only; `bhed' table)
|
||||
SFNT TT --- --- truetype OT spec (`normal' TT font)
|
||||
SFNT TT VAR --- truetype GX spec (`?var' tables)
|
||||
SFNT TT VAR --- truetype OT spec 1.8
|
||||
(`?var' + `?VAR' tables)
|
||||
|
||||
|
||||
--- PS TYPE_1 --- type1 T1_SPEC.pdf
|
||||
(PFA, Type 1 font resource)
|
||||
PFB PS TYPE_1 --- type1 T1_SPEC.pdf,
|
||||
5040.Download_Fonts.pdf
|
||||
(`normal' Type 1 font)
|
||||
--- PS TYPE_1 CID cid PLRM.pdf (CID Font Type 0;
|
||||
Type 9 font)
|
||||
--- PS MM --- type1 5015.Type1_Supp.pdf
|
||||
(Multiple Masters)
|
||||
--- PS CFF --- cff 5176.CFF.pdf (`pure' CFF)
|
||||
--- PS* CFF CID cff 5176.CFF.pdf (`pure' CFF)
|
||||
--- PS CFF SYNTHETIC --- 5176.CFF.pdf (`pure' CFF)
|
||||
--- PS CFF/MM --- cff old 5167.CFF.pdf (`pure' CFF)
|
||||
[3]
|
||||
--- PS* CFF/MM CID cff old 5167.CFF.pdf (`pure' CFF)
|
||||
[3]
|
||||
--- PS CFF/MM SYNTHETIC --- old 5167.CFF.pdf (`pure' CFF)
|
||||
[3]
|
||||
PS PS CFF --- --- PLRM.pdf (Type 2) [1]
|
||||
PS PS* CFF CID --- PLRM.pdf (Type 2) [1]
|
||||
PS PS CFF SYNTHETIC --- PLRM.pdf (Type 2) [1]
|
||||
PS PS CFF/MM --- --- PLRM.pdf (Type 2) [1]
|
||||
PS PS* CFF/MM CID --- PLRM.pdf (Type 2) [1]
|
||||
PS PS CFF/MM SYNTHETIC --- PLRM.pdf (Type 2) [1]
|
||||
--- PS --- TYPE_0 --- PLRM.pdf
|
||||
--- PS TYPE_3 --- --- PLRM.pdf (never supported)
|
||||
--- PS TYPE_3 CID --- PLRM.pdf (CID Font Type 1;
|
||||
Type 10 font; never supported)
|
||||
PS PS TYPE_14 --- --- PLRM.pdf (Chameleon font;
|
||||
Type 14 font; never supported?)
|
||||
--- PS TYPE_32 CID --- PLRM.pdf (CID Font Type 4;
|
||||
Type 32 font; never supported?)
|
||||
PS TT --- --- type42 5012.Type42_Spec.pdf
|
||||
(Type 42 font)
|
||||
PS TT --- CID --- PLRM.pdf (CID Font Type 2;
|
||||
Type 11 font)
|
||||
|
||||
|
||||
? ? CEF ? cff ?
|
||||
|
||||
|
||||
--- PCF --- --- pcf X11 [4]
|
||||
LZW PCF --- --- pcf X11 [4]
|
||||
BZ2 PCF --- --- pcf X11 [4]
|
||||
|
||||
|
||||
--- PFR* PFR0 --- pfr [2]
|
||||
--- PFR PFR1 --- --- (undocumented, proprietary;
|
||||
probably never supported)
|
||||
|
||||
|
||||
--- WINFNT* --- --- winfonts Windows developer's notes [5]
|
||||
--- WINFNT VECTOR --- --- Windows developer's notes [5]
|
||||
|
||||
|
||||
[1] Support should be rather simple since this is identical to `CFF'
|
||||
but in a PS wrapper.
|
||||
|
||||
[2] The official PFR specification is no longer available, but
|
||||
archive.org has archived it:
|
||||
|
||||
https://web.archive.org/web/20091014062300/http://www.bitstream.com/font_rendering/products/truedoc/pfrspec.html
|
||||
https://web.archive.org/web/20081115152605/http://www.bitstream.com/font_rendering/pdfs/pfrspec1.3.pdf
|
||||
|
||||
The syntax of the auxiliary data is not defined there, but is
|
||||
partially defined in MHP 1.0.3 (also called ETSI TS 101812 V1.3.1)
|
||||
section 7.4.
|
||||
|
||||
https://www.etsi.org/
|
||||
https://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=18799
|
||||
|
||||
[3] Support is rudimentary currently; some tables or data are not
|
||||
loaded yet.
|
||||
|
||||
[4] See
|
||||
|
||||
THE X WINDOW SYSTEM SERVER: X VERSION 11, RELEASE 5
|
||||
Elias Israel, Erik Fortune, Digital Press, 1992
|
||||
ISBN 1-55558-096-3
|
||||
|
||||
for a specification given in Appendix D on pgs. 436-450. However,
|
||||
this information might be out of date; unfortunately, there is no
|
||||
PCF specification available online, and this book is out of print.
|
||||
George Williams deduced the font format from the X11 sources and
|
||||
documented it for his FontForge font editor:
|
||||
|
||||
https://fontforge.github.io/pcf-format.html
|
||||
|
||||
[5] This is from MS Windows 3; see Microsoft's Knowledge Base article at
|
||||
|
||||
https://support.microsoft.com/kb/65123
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2004-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute this
|
||||
file you indicate that you have read the license and understand and
|
||||
accept it fully.
|
||||
|
||||
|
||||
--- end of formats.txt ---
|
||||
|
||||
Local Variables:
|
||||
coding: utf-8
|
||||
End:
|
|
@ -1,146 +0,0 @@
|
|||
.TH FREETYPE-CONFIG 1 "July 2021" "FreeType 2.11.0"
|
||||
.
|
||||
.
|
||||
.SH NAME
|
||||
.
|
||||
freetype-config \- Get information about a libfreetype installation
|
||||
.
|
||||
.
|
||||
.SH SYNOPSIS
|
||||
.
|
||||
.B freetype-config
|
||||
.RI [ options ]
|
||||
.
|
||||
.
|
||||
.SH DESCRIPTION
|
||||
.
|
||||
.B freetype-config
|
||||
returns information needed for compiling and linking programs with the
|
||||
FreeType library, such as linker flags and compilation parameters.
|
||||
.
|
||||
Alternatively, it can be used to query information about the
|
||||
FreeType library version installed on the system, such as the
|
||||
installation (directory path) prefix or the FreeType version number.
|
||||
.
|
||||
.PP
|
||||
If
|
||||
.BR pkg-config (1)
|
||||
is found in the path,
|
||||
.B freetype-config
|
||||
acts as a wrapper for
|
||||
.BR pkg-config .
|
||||
.
|
||||
.PP
|
||||
This program is part of the FreeType package.
|
||||
.
|
||||
.
|
||||
.SH OPTIONS
|
||||
.
|
||||
There are two types of options: output/display selection options, and
|
||||
path override options.
|
||||
.
|
||||
.
|
||||
.SS Output selection options
|
||||
.
|
||||
Only one of the output selection options should be given at each program
|
||||
invocation.
|
||||
.
|
||||
.TP
|
||||
.B \-\-prefix
|
||||
Return the prefix value of the installed FreeType library (the default
|
||||
prefix will be `/usr' in most cases for distribution-installed
|
||||
packages).
|
||||
.
|
||||
.TP
|
||||
.B \-\-exec-prefix
|
||||
Return the executable prefix value of the installed FreeType library
|
||||
(will often be the same as the prefix value).
|
||||
.
|
||||
.TP
|
||||
.B \-\-ftversion
|
||||
Return the FreeType version number, directly derived from file
|
||||
`freetype.h'.
|
||||
.
|
||||
.TP
|
||||
.B \-\-version
|
||||
Return the `libtool version' of the FreeType library.
|
||||
.
|
||||
.TP
|
||||
.B \-\-libtool
|
||||
Return the library name for linking with libtool.
|
||||
.
|
||||
.TP
|
||||
.B \-\-libs
|
||||
Return compiler flags for linking with the installed FreeType library.
|
||||
.
|
||||
.TP
|
||||
.B \-\-cflags
|
||||
Return compiler flags for compiling against the installed FreeType library.
|
||||
.
|
||||
.TP
|
||||
.B \-\-static
|
||||
Make command line options display flags for static linking.
|
||||
.
|
||||
.TP
|
||||
.B \-\-help
|
||||
Show help and exit.
|
||||
.
|
||||
.
|
||||
.SS Path override options
|
||||
.
|
||||
These affect any selected output option, except the libtool version
|
||||
returned by
|
||||
.BR \-\-version .
|
||||
.
|
||||
.TP
|
||||
.BI \-\-prefix= PREFIX
|
||||
Override
|
||||
.B \-\-prefix
|
||||
value with
|
||||
.IR PREFIX .
|
||||
.
|
||||
This also sets
|
||||
.BI \-\-exec-prefix= PREFIX
|
||||
if option
|
||||
.B \-\-exec-prefix
|
||||
is not explicitly given.
|
||||
.
|
||||
.TP
|
||||
.BI \-\-exec-prefix= EPREFIX
|
||||
Override
|
||||
.B \-\-exec-prefix
|
||||
value with
|
||||
.IR EPREFIX .
|
||||
.
|
||||
.
|
||||
.SH BUGS
|
||||
In case the libraries FreeType links to are located in non-standard
|
||||
directories, and
|
||||
.BR pkg-config (1)
|
||||
is not available, the output from option
|
||||
.B \-\-libs
|
||||
might be incomplete.
|
||||
.
|
||||
It is thus recommended to use the
|
||||
.BR pkg-config (1)
|
||||
interface instead, which is able to correctly resolve all dependencies.
|
||||
.
|
||||
.PP
|
||||
Setting
|
||||
.B \-\-exec-prefix
|
||||
(either explicitly or implicitly) might return incorrect results if
|
||||
combined with option
|
||||
.BR \-\-static .
|
||||
.
|
||||
The same problem can occur if you set the
|
||||
.B SYSROOT
|
||||
environment variable.
|
||||
.
|
||||
.
|
||||
.SH AUTHOR
|
||||
.
|
||||
This manual page was contributed by Nis Martensen <nis.martensen@web.de>,
|
||||
with further refinements from the FreeType team.
|
||||
.
|
||||
.
|
||||
.\" eof
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,635 +0,0 @@
|
|||
|
||||
How FreeType's rasterizer work
|
||||
|
||||
by David Turner
|
||||
|
||||
Revised 2007-Feb-01
|
||||
|
||||
|
||||
This file is an attempt to explain the internals of the FreeType
|
||||
rasterizer. The rasterizer is of quite general purpose and could
|
||||
easily be integrated into other programs.
|
||||
|
||||
|
||||
I. Introduction
|
||||
|
||||
II. Rendering Technology
|
||||
1. Requirements
|
||||
2. Profiles and Spans
|
||||
a. Sweeping the Shape
|
||||
b. Decomposing Outlines into Profiles
|
||||
c. The Render Pool
|
||||
d. Computing Profiles Extents
|
||||
e. Computing Profiles Coordinates
|
||||
f. Sweeping and Sorting the Spans
|
||||
|
||||
|
||||
I. Introduction
|
||||
===============
|
||||
|
||||
A rasterizer is a library in charge of converting a vectorial
|
||||
representation of a shape into a bitmap. The FreeType rasterizer
|
||||
has been originally developed to render the glyphs found in
|
||||
TrueType files, made up of segments and second-order Béziers.
|
||||
Meanwhile it has been extended to render third-order Bézier curves
|
||||
also. This document is an explanation of its design and
|
||||
implementation.
|
||||
|
||||
While these explanations start from the basics, a knowledge of
|
||||
common rasterization techniques is assumed.
|
||||
|
||||
|
||||
II. Rendering Technology
|
||||
========================
|
||||
|
||||
1. Requirements
|
||||
---------------
|
||||
|
||||
We assume that all scaling, rotating, hinting, etc., has been
|
||||
already done. The glyph is thus described by a list of points in
|
||||
the device space.
|
||||
|
||||
- All point coordinates are in the 26.6 fixed float format. The
|
||||
used orientation is:
|
||||
|
||||
|
||||
^ y
|
||||
| reference orientation
|
||||
|
|
||||
*----> x
|
||||
0
|
||||
|
||||
|
||||
`26.6' means that 26 bits are used for the integer part of a
|
||||
value and 6 bits are used for the fractional part.
|
||||
Consequently, the `distance' between two neighbouring pixels is
|
||||
64 `units' (1 unit = 1/64th of a pixel).
|
||||
|
||||
Note that, for the rasterizer, pixel centers are located at
|
||||
integer coordinates. The TrueType bytecode interpreter,
|
||||
however, assumes that the lower left edge of a pixel (which is
|
||||
taken to be a square with a length of 1 unit) has integer
|
||||
coordinates.
|
||||
|
||||
|
||||
^ y ^ y
|
||||
| |
|
||||
| (1,1) | (0.5,0.5)
|
||||
+-----------+ +-----+-----+
|
||||
| | | | |
|
||||
| | | | |
|
||||
| | | o-----+-----> x
|
||||
| | | (0,0) |
|
||||
| | | |
|
||||
o-----------+-----> x +-----------+
|
||||
(0,0) (-0.5,-0.5)
|
||||
|
||||
TrueType bytecode interpreter FreeType rasterizer
|
||||
|
||||
|
||||
A pixel line in the target bitmap is called a `scanline'.
|
||||
|
||||
- A glyph is usually made of several contours, also called
|
||||
`outlines'. A contour is simply a closed curve that delimits an
|
||||
outer or inner region of the glyph. It is described by a series
|
||||
of successive points of the points table.
|
||||
|
||||
Each point of the glyph has an associated flag that indicates
|
||||
whether it is `on' or `off' the curve. Two successive `on'
|
||||
points indicate a line segment joining the two points.
|
||||
|
||||
One `off' point amidst two `on' points indicates a second-degree
|
||||
(conic) Bézier parametric arc, defined by these three points
|
||||
(the `off' point being the control point, and the `on' ones the
|
||||
start and end points). Similarly, a third-degree (cubic) Bézier
|
||||
curve is described by four points (two `off' control points
|
||||
between two `on' points).
|
||||
|
||||
Finally, for second-order curves only, two successive `off'
|
||||
points forces the rasterizer to create, during rendering, an
|
||||
`on' point amidst them, at their exact middle. This greatly
|
||||
facilitates the definition of successive Bézier arcs.
|
||||
|
||||
The parametric form of a second-order Bézier curve is:
|
||||
|
||||
P(t) = (1-t)^2*P1 + 2*t*(1-t)*P2 + t^2*P3
|
||||
|
||||
(P1 and P3 are the end points, P2 the control point.)
|
||||
|
||||
The parametric form of a third-order Bézier curve is:
|
||||
|
||||
P(t) = (1-t)^3*P1 + 3*t*(1-t)^2*P2 + 3*t^2*(1-t)*P3 + t^3*P4
|
||||
|
||||
(P1 and P4 are the end points, P2 and P3 the control points.)
|
||||
|
||||
For both formulae, t is a real number in the range [0..1].
|
||||
|
||||
Note that the rasterizer does not use these formulae directly.
|
||||
They exhibit, however, one very useful property of Bézier arcs:
|
||||
Each point of the curve is a weighted average of the control
|
||||
points.
|
||||
|
||||
As all weights are positive and always sum up to 1, whatever the
|
||||
value of t, each arc point lies within the triangle (polygon)
|
||||
defined by the arc's three (four) control points.
|
||||
|
||||
In the following, only second-order curves are discussed since
|
||||
rasterization of third-order curves is completely identical.
|
||||
|
||||
Here some samples for second-order curves.
|
||||
|
||||
|
||||
* # on curve
|
||||
* off curve
|
||||
__---__
|
||||
#-__ _-- -_
|
||||
--__ _- -
|
||||
--__ # \
|
||||
--__ #
|
||||
-#
|
||||
Two `on' points
|
||||
Two `on' points and one `off' point
|
||||
between them
|
||||
|
||||
*
|
||||
# __ Two `on' points with two `off'
|
||||
\ - - points between them. The point
|
||||
\ / \ marked `0' is the middle of the
|
||||
- 0 \ `off' points, and is a `virtual
|
||||
-_ _- # on' point where the curve passes.
|
||||
-- It does not appear in the point
|
||||
* list.
|
||||
|
||||
|
||||
2. Profiles and Spans
|
||||
---------------------
|
||||
|
||||
The following is a basic explanation of the _kind_ of computations
|
||||
made by the rasterizer to build a bitmap from a vector
|
||||
representation. Note that the actual implementation is slightly
|
||||
different, due to performance tuning and other factors.
|
||||
|
||||
However, the following ideas remain in the same category, and are
|
||||
more convenient to understand.
|
||||
|
||||
|
||||
a. Sweeping the Shape
|
||||
|
||||
The best way to fill a shape is to decompose it into a number of
|
||||
simple horizontal segments, then turn them on in the target
|
||||
bitmap. These segments are called `spans'.
|
||||
|
||||
__---__
|
||||
_-- -_
|
||||
_- -
|
||||
- \
|
||||
/ \
|
||||
/ \
|
||||
| \
|
||||
|
||||
__---__ Example: filling a shape
|
||||
_----------_ with spans.
|
||||
_--------------
|
||||
----------------\
|
||||
/-----------------\ This is typically done from the top
|
||||
/ \ to the bottom of the shape, in a
|
||||
| | \ movement called a `sweep'.
|
||||
V
|
||||
|
||||
__---__
|
||||
_----------_
|
||||
_--------------
|
||||
----------------\
|
||||
/-----------------\
|
||||
/-------------------\
|
||||
|---------------------\
|
||||
|
||||
|
||||
In order to draw a span, the rasterizer must compute its
|
||||
coordinates, which are simply the x coordinates of the shape's
|
||||
contours, taken on the y scanlines.
|
||||
|
||||
|
||||
/---/ |---| Note that there are usually
|
||||
/---/ |---| several spans per scanline.
|
||||
| /---/ |---|
|
||||
| /---/_______|---| When rendering this shape to the
|
||||
V /----------------| current scanline y, we must
|
||||
/-----------------| compute the x values of the
|
||||
a /----| |---| points a, b, c, and d.
|
||||
- - - * * - - - - * * - - y -
|
||||
/ / b c| |d
|
||||
|
||||
|
||||
/---/ |---|
|
||||
/---/ |---| And then turn on the spans a-b
|
||||
/---/ |---| and c-d.
|
||||
/---/_______|---|
|
||||
/----------------|
|
||||
/-----------------|
|
||||
a /----| |---|
|
||||
- - - ####### - - - - ##### - - y -
|
||||
/ / b c| |d
|
||||
|
||||
|
||||
b. Decomposing Outlines into Profiles
|
||||
|
||||
For each scanline during the sweep, we need the following
|
||||
information:
|
||||
|
||||
o The number of spans on the current scanline, given by the
|
||||
number of shape points intersecting the scanline (these are
|
||||
the points a, b, c, and d in the above example).
|
||||
|
||||
o The x coordinates of these points.
|
||||
|
||||
x coordinates are computed before the sweep, in a phase called
|
||||
`decomposition' which converts the glyph into *profiles*.
|
||||
|
||||
Put it simply, a `profile' is a contour's portion that can only
|
||||
be either ascending or descending, i.e., it is monotonic in the
|
||||
vertical direction (we also say y-monotonic). There is no such
|
||||
thing as a horizontal profile, as we shall see.
|
||||
|
||||
Here are a few examples:
|
||||
|
||||
|
||||
this square
|
||||
1 2
|
||||
---->---- is made of two
|
||||
| | | |
|
||||
| | profiles | |
|
||||
^ v ^ + v
|
||||
| | | |
|
||||
| | | |
|
||||
----<----
|
||||
|
||||
up down
|
||||
|
||||
|
||||
this triangle
|
||||
|
||||
P2 1 2
|
||||
|
||||
|\ is made of two | \
|
||||
^ | \ \ | \
|
||||
| | \ \ profiles | \ |
|
||||
| | \ v ^ | \ |
|
||||
| \ | | + \ v
|
||||
| \ | | \
|
||||
P1 ---___ \ ---___ \
|
||||
---_\ ---_ \
|
||||
<--__ P3 up down
|
||||
|
||||
|
||||
|
||||
A more general contour can be made of more than two profiles:
|
||||
|
||||
__ ^
|
||||
/ | / ___ / |
|
||||
/ | / | / | / |
|
||||
| | / / => | v / /
|
||||
| | | | | | ^ |
|
||||
^ | |___| | | ^ + | + | + v
|
||||
| | | v | |
|
||||
| | | up |
|
||||
|___________| | down |
|
||||
|
||||
<-- up down
|
||||
|
||||
|
||||
Successive profiles are always joined by horizontal segments
|
||||
that are not part of the profiles themselves.
|
||||
|
||||
For the rasterizer, a profile is simply an *array* that
|
||||
associates one horizontal *pixel* coordinate to each bitmap
|
||||
*scanline* crossed by the contour's section containing the
|
||||
profile. Note that profiles are *oriented* up or down along the
|
||||
glyph's original flow orientation.
|
||||
|
||||
In other graphics libraries, profiles are also called `edges' or
|
||||
`edgelists'.
|
||||
|
||||
|
||||
c. The Render Pool
|
||||
|
||||
FreeType has been designed to be able to run well on _very_
|
||||
light systems, including embedded systems with very few memory.
|
||||
|
||||
A render pool will be allocated once; the rasterizer uses this
|
||||
pool for all its needs by managing this memory directly in it.
|
||||
The algorithms that are used for profile computation make it
|
||||
possible to use the pool as a simple growing heap. This means
|
||||
that this memory management is actually quite easy and faster
|
||||
than any kind of malloc()/free() combination.
|
||||
|
||||
Moreover, we'll see later that the rasterizer is able, when
|
||||
dealing with profiles too large and numerous to lie all at once
|
||||
in the render pool, to immediately decompose recursively the
|
||||
rendering process into independent sub-tasks, each taking less
|
||||
memory to be performed (see `sub-banding' below).
|
||||
|
||||
The render pool doesn't need to be large. A 4KByte pool is
|
||||
enough for nearly all renditions, though nearly 100% slower than
|
||||
a more comfortable 16KByte or 32KByte pool (that was tested with
|
||||
complex glyphs at sizes over 500 pixels).
|
||||
|
||||
|
||||
d. Computing Profiles Extents
|
||||
|
||||
Remember that a profile is an array, associating a _scanline_ to
|
||||
the x pixel coordinate of its intersection with a contour.
|
||||
|
||||
Though it's not exactly how the FreeType rasterizer works, it is
|
||||
convenient to think that we need a profile's height before
|
||||
allocating it in the pool and computing its coordinates.
|
||||
|
||||
The profile's height is the number of scanlines crossed by the
|
||||
y-monotonic section of a contour. We thus need to compute these
|
||||
sections from the vectorial description. In order to do that,
|
||||
we are obliged to compute all (local and global) y extrema of
|
||||
the glyph (minima and maxima).
|
||||
|
||||
|
||||
P2 For instance, this triangle has only
|
||||
two y-extrema, which are simply
|
||||
|\
|
||||
| \ P2.y as a vertical maximum
|
||||
| \ P3.y as a vertical minimum
|
||||
| \
|
||||
| \ P1.y is not a vertical extremum (though
|
||||
| \ it is a horizontal minimum, which we
|
||||
P1 ---___ \ don't need).
|
||||
---_\
|
||||
P3
|
||||
|
||||
|
||||
Note that the extrema are expressed in pixel units, not in
|
||||
scanlines. The triangle's height is certainly (P3.y-P2.y+1)
|
||||
pixel units, but its profiles' heights are computed in
|
||||
scanlines. The exact conversion is simple:
|
||||
|
||||
- min scanline = FLOOR ( min y )
|
||||
- max scanline = CEILING( max y )
|
||||
|
||||
A problem arises with Bézier Arcs. While a segment is always
|
||||
necessarily y-monotonic (i.e., flat, ascending, or descending),
|
||||
which makes extrema computations easy, the ascent of an arc can
|
||||
vary between its control points.
|
||||
|
||||
|
||||
P2
|
||||
*
|
||||
# on curve
|
||||
* off curve
|
||||
__-x--_
|
||||
_-- -_
|
||||
P1 _- - A non y-monotonic Bézier arc.
|
||||
# \
|
||||
- The arc goes from P1 to P3.
|
||||
\
|
||||
\ P3
|
||||
#
|
||||
|
||||
|
||||
We first need to be able to easily detect non-monotonic arcs,
|
||||
according to their control points. I will state here, without
|
||||
proof, that the monotony condition can be expressed as:
|
||||
|
||||
P1.y <= P2.y <= P3.y for an ever-ascending arc
|
||||
|
||||
P1.y >= P2.y >= P3.y for an ever-descending arc
|
||||
|
||||
with the special case of
|
||||
|
||||
P1.y = P2.y = P3.y where the arc is said to be `flat'.
|
||||
|
||||
As you can see, these conditions can be very easily tested.
|
||||
They are, however, extremely important, as any arc that does not
|
||||
satisfy them necessarily contains an extremum.
|
||||
|
||||
Note also that a monotonic arc can contain an extremum too,
|
||||
which is then one of its `on' points:
|
||||
|
||||
|
||||
P1 P2
|
||||
#---__ * P1P2P3 is ever-descending, but P1
|
||||
-_ is an y-extremum.
|
||||
-
|
||||
---_ \
|
||||
-> \
|
||||
\ P3
|
||||
#
|
||||
|
||||
|
||||
Let's go back to our previous example:
|
||||
|
||||
|
||||
P2
|
||||
*
|
||||
# on curve
|
||||
* off curve
|
||||
__-x--_
|
||||
_-- -_
|
||||
P1 _- - A non-y-monotonic Bézier arc.
|
||||
# \
|
||||
- Here we have
|
||||
\ P2.y >= P1.y &&
|
||||
\ P3 P2.y >= P3.y (!)
|
||||
#
|
||||
|
||||
|
||||
We need to compute the vertical maximum of this arc to be able
|
||||
to compute a profile's height (the point marked by an `x'). The
|
||||
arc's equation indicates that a direct computation is possible,
|
||||
but we rely on a different technique, which use will become
|
||||
apparent soon.
|
||||
|
||||
Bézier arcs have the special property of being very easily
|
||||
decomposed into two sub-arcs, which are themselves Bézier arcs.
|
||||
Moreover, it is easy to prove that there is at most one vertical
|
||||
extremum on each Bézier arc (for second-degree curves; similar
|
||||
conditions can be found for third-order arcs).
|
||||
|
||||
For instance, the following arc P1P2P3 can be decomposed into
|
||||
two sub-arcs Q1Q2Q3 and R1R2R3:
|
||||
|
||||
|
||||
P2
|
||||
*
|
||||
# on curve
|
||||
* off curve
|
||||
|
||||
|
||||
original Bézier arc P1P2P3.
|
||||
__---__
|
||||
_-- --_
|
||||
_- -_
|
||||
- -
|
||||
/ \
|
||||
/ \
|
||||
# #
|
||||
P1 P3
|
||||
|
||||
|
||||
|
||||
P2
|
||||
*
|
||||
|
||||
|
||||
|
||||
Q3 Decomposed into two subarcs
|
||||
Q2 R2 Q1Q2Q3 and R1R2R3
|
||||
* __-#-__ *
|
||||
_-- --_
|
||||
_- R1 -_ Q1 = P1 R3 = P3
|
||||
- - Q2 = (P1+P2)/2 R2 = (P2+P3)/2
|
||||
/ \
|
||||
/ \ Q3 = R1 = (Q2+R2)/2
|
||||
# #
|
||||
Q1 R3 Note that Q2, R2, and Q3=R1
|
||||
are on a single line which is
|
||||
tangent to the curve.
|
||||
|
||||
|
||||
We have then decomposed a non-y-monotonic Bézier curve into two
|
||||
smaller sub-arcs. Note that in the above drawing, both sub-arcs
|
||||
are monotonic, and that the extremum is then Q3=R1. However, in
|
||||
a more general case, only one sub-arc is guaranteed to be
|
||||
monotonic. Getting back to our former example:
|
||||
|
||||
|
||||
Q2
|
||||
*
|
||||
|
||||
__-x--_ R1
|
||||
_-- #_
|
||||
Q1 _- Q3 - R2
|
||||
# \ *
|
||||
-
|
||||
\
|
||||
\ R3
|
||||
#
|
||||
|
||||
|
||||
Here, we see that, though Q1Q2Q3 is still non-monotonic, R1R2R3
|
||||
is ever descending: We thus know that it doesn't contain the
|
||||
extremum. We can then re-subdivide Q1Q2Q3 into two sub-arcs and
|
||||
go on recursively, stopping when we encounter two monotonic
|
||||
subarcs, or when the subarcs become simply too small.
|
||||
|
||||
We will finally find the vertical extremum. Note that the
|
||||
iterative process of finding an extremum is called `flattening'.
|
||||
|
||||
|
||||
e. Computing Profiles Coordinates
|
||||
|
||||
Once we have the height of each profile, we are able to allocate
|
||||
it in the render pool. The next task is to compute coordinates
|
||||
for each scanline.
|
||||
|
||||
In the case of segments, the computation is straightforward,
|
||||
using the Euclidean algorithm (also known as Bresenham).
|
||||
However, for Bézier arcs, the job is a little more complicated.
|
||||
|
||||
We assume that all Béziers that are part of a profile are the
|
||||
result of flattening the curve, which means that they are all
|
||||
y-monotonic (ascending or descending, and never flat). We now
|
||||
have to compute the intersections of arcs with the profile's
|
||||
scanlines. One way is to use a similar scheme to flattening
|
||||
called `stepping'.
|
||||
|
||||
|
||||
Consider this arc, going from P1 to
|
||||
--------------------- P3. Suppose that we need to
|
||||
compute its intersections with the
|
||||
drawn scanlines. As already
|
||||
--------------------- mentioned this can be done
|
||||
directly, but the involved
|
||||
* P2 _---# P3 algorithm is far too slow.
|
||||
------------- _-- --
|
||||
_-
|
||||
_/ Instead, it is still possible to
|
||||
---------/----------- use the decomposition property in
|
||||
/ the same recursive way, i.e.,
|
||||
| subdivide the arc into subarcs
|
||||
------|-------------- until these get too small to cross
|
||||
| more than one scanline!
|
||||
|
|
||||
-----|--------------- This is very easily done using a
|
||||
| rasterizer-managed stack of
|
||||
| subarcs.
|
||||
# P1
|
||||
|
||||
|
||||
f. Sweeping and Sorting the Spans
|
||||
|
||||
Once all our profiles have been computed, we begin the sweep to
|
||||
build (and fill) the spans.
|
||||
|
||||
As both the TrueType and Type 1 specifications use the winding
|
||||
fill rule (but with opposite directions), we place, on each
|
||||
scanline, the present profiles in two separate lists.
|
||||
|
||||
One list, called the `left' one, only contains ascending
|
||||
profiles, while the other `right' list contains the descending
|
||||
profiles.
|
||||
|
||||
As each glyph is made of closed curves, a simple geometric
|
||||
property ensures that the two lists contain the same number of
|
||||
elements.
|
||||
|
||||
Creating spans is thus straightforward:
|
||||
|
||||
1. We sort each list in increasing horizontal order.
|
||||
|
||||
2. We pair each value of the left list with its corresponding
|
||||
value in the right list.
|
||||
|
||||
|
||||
/ / | | For example, we have here
|
||||
/ / | | four profiles. Two of
|
||||
>/ / | | | them are ascending (1 &
|
||||
1// / ^ | | | 2 3), while the two others
|
||||
// // 3| | | v are descending (2 & 4).
|
||||
/ //4 | | | On the given scanline,
|
||||
a / /< | | the left list is (1,3),
|
||||
- - - *-----* - - - - *---* - - y - and the right one is
|
||||
/ / b c| |d (4,2) (sorted).
|
||||
|
||||
There are then two spans, joining
|
||||
1 to 4 (i.e. a-b) and 3 to 2
|
||||
(i.e. c-d)!
|
||||
|
||||
|
||||
Sorting doesn't necessarily take much time, as in 99 cases out
|
||||
of 100, the lists' order is kept from one scanline to the next.
|
||||
We can thus implement it with two simple singly-linked lists,
|
||||
sorted by a classic bubble-sort, which takes a minimum amount of
|
||||
time when the lists are already sorted.
|
||||
|
||||
A previous version of the rasterizer used more elaborate
|
||||
structures, like arrays to perform `faster' sorting. It turned
|
||||
out that this old scheme is not faster than the one described
|
||||
above.
|
||||
|
||||
Once the spans have been `created', we can simply draw them in
|
||||
the target bitmap.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2003-2021 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
modified, and distributed under the terms of the FreeType project
|
||||
license, LICENSE.TXT. By continuing to use, modify, or distribute this
|
||||
file you indicate that you have read the license and understand and
|
||||
accept it fully.
|
||||
|
||||
|
||||
--- end of raster.txt ---
|
||||
|
||||
Local Variables:
|
||||
coding: utf-8
|
||||
End:
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue