raster-oracle-diff.dhover×1285all
#!/usr/bin/env dub
/+ dub.sdl:
    name "font_libraries_raster_oracle_diff"
    targetPath "build"
    libs "harfbuzz" "freetype"
    buildType "checked" {
        buildOptions "optimize" "inline" "debugInfo"
    }
+/
/**
 * How close is a signed-area accumulation rasterizer to FreeType? Renders
 * every glyph of each face at 12, 16, 24 and 48 pixels per em, unhinted, both
 * with the rasterizer of outline-sink-raster.d and with FreeType
 * (`FT_LOAD_NO_HINTING | FT_LOAD_RENDER`), and reports the distribution of
 * per-pixel coverage differences in 1/255 steps.
 *
 * Four comparisons per face and size:
 *
 *   production     the D rasterizer — adaptive flattening to 0.02 px, and 4x4
 *                  supersampling for glyphs whose `glyf` data sets
 *                  OVERLAP_SIMPLE (0x40 on the first point) or
 *                  OVERLAP_COMPOUND (0x0400), FreeType's rule (ttgload.c,
 *                  ftsmooth.c) — against FreeType;
 *   ftFlatten      the same with curves flattened by FreeType's own ftgrays.c
 *                  rules, against FreeType: the accumulation arithmetic alone
 *                  (FTR3);
 *   fineReference  production against the D rasterizer at 0.001 px: the
 *                  flattening error alone (FTR8);
 *   unflagged      each glyph the font does not flag, against its own 4x4
 *                  render: overlaps the flag fails to declare (FXP34).
 *
 * FreeType is reached through hand-declared prototypes. Only the leading
 * fields of `FT_FaceRec` and `FT_GlyphSlotRec` are declared, and they are
 * checked against HarfBuzz's view of the same face before any glyph is
 * compared.
 *
 * Spike S2 of docs/specs/font/PLAN.md; docs/specs/font/testing.md § Raster
 * oracle records the result; FTX9 and FTX10 in decisions.md the choices.
 *
 * Run with: dub run --single raster-oracle-diff.d [-- font.ttf ...]
 *
 * Font resolution: the arguments if given, else `fc-match -f %{file}
 * monospace`. If neither yields a readable file, prints a `SKIP:` line and
 * exits 0 so CI stays green.
 */
module 
(module) font_libraries_raster_oracle_diff

How close is a signed-area accumulation rasterizer to FreeType? Renders every glyph of each face at 12, 16, 24 and 48 pixels per em, unhinted, both with the rasterizer of outline-sink-raster.d and with FreeType (FT_LOAD_NO_HINTING | FT_LOAD_RENDER), and reports the distribution of per-pixel coverage differences in 1/255 steps.

Four comparisons per face and size:

production the D rasterizer — adaptive flattening to 0.02 px, and 4x4 supersampling for glyphs whose glyf data sets OVERLAP_SIMPLE (0x40 on the first point) or OVERLAP_COMPOUND (0x0400), FreeType's rule (ttgload.c, ftsmooth.c) — against FreeType; ftFlatten the same with curves flattened by FreeType's own ftgrays.c rules, against FreeType: the accumulation arithmetic alone (FTR3); fineReference production against the D rasterizer at 0.001 px: the flattening error alone (FTR8); unflagged each glyph the font does not flag, against its own 4x4 render: overlaps the flag fails to declare (FXP34).

FreeType is reached through hand-declared prototypes. Only the leading fields of FT_FaceRec and FT_GlyphSlotRec are declared, and they are checked against HarfBuzz's view of the same face before any glyph is compared.

Spike S2 of docs/specs/font/PLAN.md; docs/specs/font/testing.md § Raster oracle records the result; FTX9 and FTX10 in decisions.md the choices.

Run with: dub run --single raster-oracle-diff.d [-- font.ttf ...]

Font resolution: the arguments if given, else fc-match -f %{file} monospace. If neither yields a readable file, prints a SKIP: line and exits 0 so CI stays green.

font_libraries_raster_oracle_diff
;
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.config

D compatible types that correspond to various basic types in associated C and C++ compilers.

Source

core/stdc/config.d

@copyrightCopyright Sean Kelly 2005 - 2009.@licenseDistributed under the Boost Software License 1.0. (See accompanying file LICENSE)@authorsSean Kelly@standardsISO/IEC 9899:1999 (E)
config
: c_long;
import
(package) std
std
.
(module) std.algorithm

This package implements generic algorithms oriented towards the processing of sequences. Sequences processed by these functions define range-based interfaces. See also Reference on ranges and tutorial on ranges.

Algorithms are categorized into the following submodules:

Submodule Functions

| Searching | all any balancedParens boyerMooreFinder canFind commonPrefix count countUntil endsWith find findAdjacent findAmong findSkip findSplit findSplitAfter findSplitBefore minCount maxCount minElement maxElement minIndex maxIndex minPos maxPos skipOver startsWith until |

| Comparison | among castSwitch clamp cmp either equal isPermutation isSameLength levenshteinDistance levenshteinDistanceAndPath max min mismatch predSwitch |

| Iteration | cache cacheBidirectional chunkBy cumulativeFold each filter filterBidirectional fold group joiner map mean permutations reduce splitWhen splitter substitute sum uniq |

| Sorting | completeSort isPartitioned isSorted isStrictlyMonotonic ordered strictlyOrdered makeIndex merge multiSort nextEvenPermutation nextPermutation nthPermutation partialSort partition partition3 schwartzSort sort topN topNCopy topNIndex |

| Set operations (setops) | cartesianProduct largestPartialIntersection largestPartialIntersectionWeighted multiwayMerge multiwayUnion setDifference setIntersection setSymmetricDifference |

| Mutation | bringToFront copy fill initializeAll move moveAll moveSome moveEmplace moveEmplaceAll moveEmplaceSome remove reverse strip stripLeft stripRight swap swapRanges uninitializedFill |

Many functions in this package are parameterized with a predicate. The predicate may be any suitable callable type (a function, a delegate, a functor, or a lambda), or a compile-time string. The string may consist of any legal D expression that uses the symbol a (for unary functions) or the symbols a and b (for binary functions). These names will NOT interfere with other homonym symbols in user code because they are evaluated in a different context. The default for all binary comparison predicates is "a == b" for unordered operations and "a < b" for ordered operations.

Example

int[] a = ...;
static bool greater(int a, int b)
{
    return a > b;
}
sort!greater(a);           // predicate as alias
sort!((a, b) => a > b)(a); // predicate as a lambda.
sort!"a > b"(a);           // predicate as string
                           // (no ambiguity with array name)
sort(a);                   // no predicate, "a < b" is implicit

Source

std/algorithm/package.d

@copyrightAndrei Alexandrescu 2008-.@licenseBoost License 1.0.@authorsAndrei Alexandrescu
algorithm
:
(alias template) font_libraries_raster_oracle_diff.count = std.algorithm.searching.count(alias pred = "a == b", Range, E)(Range haystack, E needle) if (isInputRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(haystack.front, needle))))

Counts matches of needle in haystack.

The first overload counts each element e in haystack for which pred(e, needle) is true. pred defaults to equality. Performs O(haystack.length) evaluations of pred.

The second overload counts the number of times needle was matched in haystack. pred compares elements in each range. Throws an exception if needle.empty is true, as the count of the empty range in any range would be infinite. Overlapped counts are not considered, for example ``count("aaa", "aa") is 1, not 2.

Note

Regardless of the overload, count will not accept infinite ranges for haystack.

@parampred The predicate to compare elements.@paramhaystack The range to count.@paramneedle The element or sub-range to count in haystack.@returnsThe number of matches in haystack.
count
,
(alias template) font_libraries_raster_oracle_diff.max = std.algorithm.comparison.max(T...)(T args) if (T.length >= 2 && !is(CommonType!T == void))

Iterates the passed arguments and returns the maximum value.

@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
,
(alias template) font_libraries_raster_oracle_diff.min = std.algorithm.comparison.min(T...)(T args) if (T.length >= 2 && !is(CommonType!T == void))

Iterates the passed arguments and returns the minimum value.

@paramargs The values to select the minimum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe minimum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the smallest value. If at least one of the arguments is NaN, the result is an unspecified value. See minElement for examples on how to cope with NaNs.@seeminElement
min
,
(alias template) font_libraries_raster_oracle_diff.sort = std.algorithm.sorting.sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Range)(Range r)

Sorts a random-access range according to the predicate less.

Performs O(r.length * log(r.length)) evaluations of less. If less involves expensive computations on the sort key, it may be worthwhile to use schwartzSort instead.

Stable sorting requires hasAssignableElements!Range to be true.

sort returns a SortedRange over the original range, allowing functions that can take advantage of sorted data to know that the range is sorted and adjust accordingly. The SortedRange is a wrapper around the original range, so both it and the original range are sorted. Other functions can't know that the original range has been sorted, but they can know that SortedRange has been sorted.

Preconditions

The predicate is expected to satisfy certain rules in order for sort to behave as expected - otherwise, the program may fail on certain inputs (but not others) when not compiled in release mode, due to the cursory assumeSorted check. Specifically, sort expects less(a,b) && less(b,c) to imply less(a,c) (transitivity), and, conversely, !less(a,b) && !less(b,c) to imply !less(a,c). Note that the default predicate ("a < b") does not always satisfy these conditions for floating point types, because the expression will always be false when either a or b is NaN. Use cmp instead.

Algorithms

Introsort is used for unstable sorting and Timsort is used for stable sorting. Each algorithm has benefits beyond stability. Introsort is generally faster but Timsort may achieve greater speeds on data with low entropy or if predicate calls are expensive. Introsort performs no allocations whereas Timsort will perform one or more allocations per call. Both algorithms have O(n log n) worst-case time complexity.

@paramless The predicate to sort by.@paramss The swapping strategy to use.@paramr The range to sort.@returnsThe initial range wrapped as a SortedRange with the predicate binaryFun!less.@see

assumeSorted

SortedRange

SwapStrategy

binaryFun

sort
;
import
(package) std
std
.
(module) std.file

Utilities for manipulating files and scanning directories. Functions in this module handle files as a unit, e.g., read or write one file at a time. For opening files and manipulating them via handles refer to module std.stdio.

Category Functions
General exists isDir isFile isSymlink rename thisExePath
Directories chdir dirEntries getcwd mkdir mkdirRecurse rmdir rmdirRecurse tempDir
Files append copy read readText remove slurp write
Symlinks symlink readLink
Attributes attrIsDir attrIsFile attrIsSymlink getAttributes getLinkAttributes getSize setAttributes
Timestamp getTimes getTimesWin setTimes timeLastModified timeLastAccessed timeStatusChanged
Other DirEntry FileException PreserveAttributes SpanMode getAvailableDiskSpace

Source

std/file.d

@copyrightCopyright The D Language Foundation 2007 - 2011.@seeThe official tutorial for an introduction to working with files in D, module std.stdio for opening files and manipulating them via handles, and module std.path for manipulating path strings.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Jonathan M Davis
file
:
(alias template) font_libraries_raster_oracle_diff.exists = std.file.exists(R)(R name) if (isSomeFiniteCharInputRange!R && !isConvertibleToString!R)

Determine whether the given file (or directory) exists.

@paramname string or range of characters representing the file name@returnstrue if the file name specified as input exists
exists
,
(alias template) font_libraries_raster_oracle_diff.read = std.file.read(R)(R name, size_t upTo = size_t.max) if (isSomeFiniteCharInputRange!R && !isConvertibleToString!R)

Read entire contents of file name and returns it as an untyped array. If the file size is larger than upTo, only upTo bytes are read.

@paramname string or range of characters representing the file name@paramupTo if present, the maximum number of bytes to read@returnsUntyped array of bytes read.@throwsFileException on error.@seereadText for reading and validating a text file.
read
;
import
(package) std
std
.
(module) std.math

Contains the elementary mathematical functions (powers, roots, and trigonometric functions), and low-level floating-point operations. Mathematical special functions are available in std.mathspecial.

Category Members
Constants E PI PI_2 PI4 M1_PI M2_PI M2_SQRTPI LN10 LN2 LOG2 LOG2E LOG2T LOG10E SQRT2 SQRT1_2
Algebraic abs fabs sqrt cbrt hypot poly nextPow2 truncPow2
Trigonometry sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh atanh
Rounding ceil floor round lround trunc rint lrint nearbyint rndtol quantize
Exponentiation & Logarithms pow powmod exp exp2 expm1 ldexp frexp log log2 log10 logb ilogb log1p scalbn
Remainder fmod modf remainder remquo
Floating-point operations approxEqual feqrel fdim fmax fmin fma isClose nextDown nextUp nextafter NaN getNaNPayload cmp
Introspection isFinite isIdentical isInfinity isNaN isNormal isSubnormal signbit sgn copysign isPowerOf2
Hardware Control IeeeFlags ieeeFlags resetIeeeFlags FloatingPointControl

The functionality closely follows the IEEE754-2008 standard for floating-point arithmetic, including the use of camelCase names rather than C99-style lower case names. All of these functions behave correctly when presented with an infinity or NaN.

The following IEEE 'real' formats are currently supported:

  • 64 bit Big-endian 'double' (eg PowerPC)

  • 128 bit Big-endian 'quadruple' (eg SPARC)

  • 64 bit Little-endian 'double' (eg x86-SSE2)

  • 80 bit Little-endian, with implied bit 'real80' (eg x87, Itanium)

  • 128 bit Little-endian 'quadruple' (not implemented on any known processor!)

  • Non-IEEE 128 bit Big-endian 'doubledouble' (eg PowerPC) has partial support

Unlike C, there is no global 'errno' variable. Consequently, almost all of these functions are pure nothrow.

Source

std/math/package.d

@copyrightCopyright The D Language Foundation 2000 - 2011. D implementations of tan, atan, atan2, exp, expm1, exp2, log, log10, log1p, log2, floor, ceil and lrint functions are based on the CEPHES math library, which is Copyright (C) 2001 Stephen L. Moshier <steve@moshier.net> and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different copying permissions. These modifications are distributed here under the following terms:@licenseBoost License 1.0.@authorsWalter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw and David Nadlinger
math
:
(alias template) font_libraries_raster_oracle_diff.abs = std.math.algebraic.abs(Num)(Num x) if (isIntegral!Num || is(typeof(Num.init >= 0)) && is(typeof(-Num.init)))

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
,
(alias) font_libraries_raster_oracle_diff.ceil = real std.math.rounding.ceil(real x) pure nothrow @nogc @trusted

Returns the value of x rounded upward to the next integer (toward positive infinity).

ceil
,
(alias) font_libraries_raster_oracle_diff.floor = real std.math.rounding.floor(real x) pure nothrow @nogc @trusted

Returns the value of x rounded downward to the next integer (toward negative infinity).

floor
,
(alias template) font_libraries_raster_oracle_diff.hypot = std.math.algebraic.hypot(T)(const T x, const T y) if (isFloatingPoint!T)

Calculates the length of the hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of the sums of the squares of x and y:

sqrt(x, 2 + y, 2)

Note that hypot(x, y), hypot(y, x) and hypot(x, -y) are equivalent.

x y hypot(x, y) invalid?
x 0.0 x no
y + no
+ no
y != no
hypot
,
(alias) font_libraries_raster_oracle_diff.sqrt = float std.math.algebraic.sqrt(float x) pure nothrow @nogc @safe

Compute square root of x.

x sqrt(x) invalid?
-0.0 -0.0 no
<0.0 yes
+ + no
sqrt
;
import
(package) std
std
.
(module) std.path

This module is used to manipulate path strings.

All functions, with the exception of expandTilde (and in some cases absolutePath and relativePath), are pure string manipulation functions; they don't depend on any state outside the program, nor do they perform any actual file system actions. This has the consequence that the module does not make any distinction between a path that points to a directory and a path that points to a file, and it does not know whether or not the object pointed to by the path actually exists in the file system. To differentiate between these cases, use isDir and exists.

Note that on Windows, both the backslash (\) and the slash (/) are in principle valid directory separators. This module treats them both on equal footing, but in cases where a new separator is added, a backslash will be used. Furthermore, the buildNormalizedPath function will replace all slashes with backslashes on that platform.

In general, the functions in this module assume that the input paths are well-formed. (That is, they should not contain invalid characters, they should follow the file system's path format, etc.) The result of calling a function on an ill-formed path is undefined. When there is a chance that a path or a file name is invalid (for instance, when it has been input by the user), it may sometimes be desirable to use the isValidFilename and isValidPath functions to check this.

Most functions do not perform any memory allocations, and if a string is returned, it is usually a slice of an input string. If a function allocates, this is explicitly mentioned in the documentation.

Category Functions
Normalization absolutePath asAbsolutePath asNormalizedPath asRelativePath buildNormalizedPath buildPath chainPath expandTilde
Partitioning baseName dirName dirSeparator driveName pathSeparator pathSplitter relativePath rootName stripDrive
Validation isAbsolute isDirSeparator isRooted isValidFilename isValidPath
Extension defaultExtension extension setExtension stripExtension withDefaultExtension withExtension
Other filenameCharCmp filenameCmp globMatch CaseSensitive

Source

std/path.d

@authorsLars Tandle Kyllingstad, Walter Bright, Grzegorz Adam Hankiewicz, Thomas Khne, Andrei Alexandrescu@copyrightCopyright (c) 2000-2014, the authors. All rights reserved.@licenseBoost License 1.0
path
:
(alias template) font_libraries_raster_oracle_diff.baseName = std.path.baseName(R)(return scope R path) if (isRandomAccessRange!R && hasSlicing!R && isSomeChar!(ElementType!R) && !isSomeString!R)

Note

This function only strips away the specified suffix, which doesn't necessarily have to represent an extension. To remove the extension from a path, regardless of what the extension is, use stripExtension. To obtain the filename without leading directories and without an extension, combine the functions like this:

assert(baseName(stripExtension("dir/file.ext")) == "file");
@paramcs Whether or not suffix matching is case-sensitive.@parampath A path name. It can be a string, or any random-access range of characters.@paramsuffix An optional suffix to be removed from the file name.@returns

The name of the file in the path name, without any leading directory and with an optional suffix chopped off.

If suffix is specified, it will be compared to path using filenameCmp!cs, where cs is an optional template parameter determining whether the comparison is case sensitive or not. See the filenameCmp documentation for details.

@standardsThis function complies with the POSIX requirements for the 'basename' shell utility (with suitable adaptations for Windows paths).
baseName
;
import
(package) std
std
.
(module) std.process

Functions for starting and interacting with other processes, and for working with the current process' execution environment.

Process handling

  • `spawnProcess` spawns a new `process`, optionally assigning it an
        

    arbitrary set of standard input, output, and error streams. The function returns immediately, leaving the child process to execute in parallel with its parent. All other functions in this module that spawn processes are built around spawnProcess.

  • `wait` makes the parent `process` wait for a child `process` to
        

    terminate. In general one should always do this, to avoid child processes becoming "zombies" when the parent process exits. Scope guards are perfect for this – see the spawnProcess documentation for examples. tryWait is similar to wait, but does not block if the process has not yet terminated.

  • `pipeProcess` also spawns a child `process` which runs
        

    in parallel with its parent. However, instead of taking arbitrary streams, it automatically creates a set of pipes that allow the parent to communicate with the child through the child's standard input, output, and/or error streams. This function corresponds roughly to C's popen function.

  • `execute` starts a new `process` and waits for it
        

    to complete before returning. Additionally, it captures the process' standard output and error streams and returns the output of these as a string.

  • `spawnShell`, `pipeShell` and `executeShell` work like
        

    spawnProcess, pipeProcess and execute, respectively, except that they take a single command string and run it through the current user's default command interpreter. executeShell corresponds roughly to C's system function.

  • `kill` attempts to terminate a running `process`.
    
    

The following table compactly summarises the different process creation functions and how they relate to each other:

Runs program directly
Runs shell command
Low-level process creation
spawnProcess
spawnShell
Automatic input/output redirection using pipes
pipeProcess
pipeShell
Execute and wait for completion, collect output
execute
executeShell

Other functionality

  • `pipe` is used to create unidirectional pipes.
    
  • `environment` is an interface through which the current `process`'
        

    environment variables can be read and manipulated.

  • `escapeShellCommand` and `escapeShellFileName` are useful
        

    for constructing shell command lines in a portable way.

Source

std/process.d

Note

Most of the functionality in this module is not available on iOS, tvOS and watchOS. The only functions available on those platforms are: environment, thisProcessID and thisThreadID.

@authorsLars Tandle Kyllingstad, Steven Schveighoffer, Vladimir Panteleev@copyrightCopyright (c) 2013, the authors. All rights reserved.@licenseBoost License 1.0.
process
:
(alias) font_libraries_raster_oracle_diff.execute = std.typecons.Tuple!(int, "status", string, "output") std.process.execute(scope const(char[])[] args, const(string[string]) env = cast(const(string[string]))null, std.process.Config config = Config(Flags.none, null, null), ulong maxOutput = 18446744073709551615LU, scope const(char)[] workDir = null) @safe

Executes the given program or shell command and returns its exit code and output.

execute and executeShell start a new process using spawnProcess and spawnShell, respectively, and wait for the process to complete before returning. The functions capture what the child process prints to both its standard output and standard error streams, and return this together with its exit code.

auto dmd = execute(["dmd", "myapp.d"]);
if (dmd.status != 0) writeln("Compilation failed:\n", dmd.output);

auto ls = executeShell("ls -l");
if (ls.status != 0) writeln("Failed to retrieve file listing");
else writeln(ls.output);

The args/program/command, env and config parameters are forwarded straight to the underlying spawn functions, and we refer to their documentation for details.

POSIX specific

If the process is terminated by a signal, the status field of the return value will contain a negative number whose absolute value is the signal number. (See wait for details.)

@paramargs An array which contains the program name as the zeroth element and any command-line arguments in the following elements. (See spawnProcess for details.)@paramprogram The program name, without command-line arguments. (See spawnProcess for details.)@paramcommand A shell command which is passed verbatim to the command interpreter. (See spawnShell for details.)@paramenv Additional environment variables for the child process. (See spawnProcess for details.)@paramconfig Flags that control process creation. See Config for an overview of available flags, and note that the retainStd... flags have no effect in this function.@parammaxOutput The maximum number of bytes of output that should be captured.@paramworkDir The working directory for the new process. By default the child process inherits the parent's working directory.@paramshellPath The path to the shell to use to run the specified program. By default this is nativeShell.@returnsAn std.typecons.Tuple!(int, "status", string, "output").@throws

ProcessException on failure to start the process.

StdioException on failure to capture output.

execute
;
import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) font_libraries_raster_oracle_diff.writefln = std.stdio.writefln(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))

Equivalent to writef(fmt, args, '\n').

writefln
,
(alias template) font_libraries_raster_oracle_diff.writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
;
import
(package) std
std
.
(module) std.string

String handling functions.

Category Functions
Searching
column
indexOf
indexOfAny
indexOfNeither
lastIndexOf
lastIndexOfAny
lastIndexOfNeither
Comparison
isNumeric
Mutation
capitalize
Pruning and Filling
center
chomp
chompPrefix
chop
detabber
detab
entab
entabber
leftJustify
outdent
rightJustify
strip
stripLeft
stripRight
wrap
Substitution
abbrev
soundex
soundexer
succ
tr
translate
Miscellaneous
assumeUTF
fromStringz
lineSplitter
representation
splitLines
toStringz
Objects of types string, wstring, and dstring are value types
and cannot be mutated element-by-element. For using mutation during building
strings, use char[], wchar[], or dchar[]. The xxxstring
types are preferable because they don't exhibit undesired aliasing, thus
making code more robust.

The following functions are publicly imported:

Module Functions
Publicly imported functions
std.algorithm
cmp, std,algorithm,comparison
count, std,algorithm,searching
endsWith, std,algorithm,searching
startsWith, std,algorithm,searching
std.array
join, std,array
replace, std,array
replaceInPlace, std,array
split, std,array
empty, std,array
std.format
format, std,format
sformat, std,format
std.uni
icmp, std,uni
toLower, std,uni
toLowerInPlace, std,uni
toUpper, std,uni
toUpperInPlace, std,uni
There is a rich set of functions for string handling defined in other modules.
Functions related to Unicode and ASCII are found in std.uni
and std.ascii, respectively. Other functions that have a
wider generality than just strings can be found in std.algorithm
and std.range.

Source

std/string.d

@seestd.algorithm and std.range for generic range algorithms , std.ascii for functions that work with ASCII strings , std.uni for functions that work with unicode strings@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Jonathan M Davis, and David L. 'SpottedTiger' Davis
string
:
(alias template) font_libraries_raster_oracle_diff.strip = std.string.strip(Range)(Range str) if (isSomeString!Range || isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && !isConvertibleToString!Range && isSomeChar!(ElementEncodingType!Range))

Strips both leading and trailing whitespace (as defined by isWhite) or as specified in the second argument.

@paramstr string or random access range of characters@paramchars string of characters to be stripped@paramleftChars string of leading characters to be stripped@paramrightChars string of trailing characters to be stripped@returnsslice of str stripped of leading and trailing whitespace or characters as specified in the second argument.@seeGeneric stripping on ranges: strip
strip
,
(alias) font_libraries_raster_oracle_diff.toStringz = immutable(char)* std.string.toStringz(scope const(char)[] s) pure nothrow @trusted
@params A D-style string.@returns

A C-style null-terminated string equivalent to s. s must not contain embedded '\0''s as any C function will treat the first '\0' that it sees as the end of the string. If s.empty is true, then a string containing only '\0' is returned.

Important Note: When passing a char* to a C function, and the C function keeps it around for any reason, make sure that you keep a reference to it in your D code. Otherwise, it may become invalid during a garbage collection cycle and cause a nasty bug when the C code tries to use it.

toStringz
;
// --------------------------------------------------------------------------- // HarfBuzz and FreeType C ABIs, the subsets this program needs. // --------------------------------------------------------------------------- extern (C) nothrow @nogc { struct
(struct) font_libraries_raster_oracle_diff.hb_blob_t
hb_blob_t
;
struct
(struct) font_libraries_raster_oracle_diff.hb_face_t
hb_face_t
;
struct
(struct) font_libraries_raster_oracle_diff.hb_font_t
hb_font_t
;
struct
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
;
struct
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
;
alias
(alias) font_libraries_raster_oracle_diff.MoveToFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, void*) nothrow @nogc
MoveToFn
= void function(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*, float, float, void*);
alias
(alias) font_libraries_raster_oracle_diff.QuadToFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, void*) nothrow @nogc
QuadToFn
= void function(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*,
float, float, float, float, void*); alias
(alias) font_libraries_raster_oracle_diff.CubicToFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, float, float, void*) nothrow @nogc
CubicToFn
= void function(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*,
float, float, float, float, float, float, void*); alias
(alias) font_libraries_raster_oracle_diff.CloseFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, void*) nothrow @nogc
CloseFn
= void function(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*, void*);
(struct) font_libraries_raster_oracle_diff.hb_blob_t
hb_blob_t
*
font_libraries_raster_oracle_diff.hb_blob_t* font_libraries_raster_oracle_diff.hb_blob_create_from_file(const(char)*) nothrow @nogc
hb_blob_create_from_file
(const(char)*);
void
void font_libraries_raster_oracle_diff.hb_blob_destroy(font_libraries_raster_oracle_diff.hb_blob_t*) nothrow @nogc
hb_blob_destroy
(
(struct) font_libraries_raster_oracle_diff.hb_blob_t
hb_blob_t
*);
uint
uint font_libraries_raster_oracle_diff.hb_blob_get_length(font_libraries_raster_oracle_diff.hb_blob_t*) nothrow @nogc
hb_blob_get_length
(
(struct) font_libraries_raster_oracle_diff.hb_blob_t
hb_blob_t
*);
(struct) font_libraries_raster_oracle_diff.hb_face_t
hb_face_t
*
font_libraries_raster_oracle_diff.hb_face_t* font_libraries_raster_oracle_diff.hb_face_create(font_libraries_raster_oracle_diff.hb_blob_t*, uint) nothrow @nogc
hb_face_create
(
(struct) font_libraries_raster_oracle_diff.hb_blob_t
hb_blob_t
*, uint);
void
void font_libraries_raster_oracle_diff.hb_face_destroy(font_libraries_raster_oracle_diff.hb_face_t*) nothrow @nogc
hb_face_destroy
(
(struct) font_libraries_raster_oracle_diff.hb_face_t
hb_face_t
*);
uint
uint font_libraries_raster_oracle_diff.hb_face_get_upem(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogc
hb_face_get_upem
(const(
(struct) font_libraries_raster_oracle_diff.hb_face_t
hb_face_t
)*);
uint
uint font_libraries_raster_oracle_diff.hb_face_get_glyph_count(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogc
hb_face_get_glyph_count
(const(
(struct) font_libraries_raster_oracle_diff.hb_face_t
hb_face_t
)*);
(struct) font_libraries_raster_oracle_diff.hb_font_t
hb_font_t
*
font_libraries_raster_oracle_diff.hb_font_t* font_libraries_raster_oracle_diff.hb_font_create(font_libraries_raster_oracle_diff.hb_face_t*) nothrow @nogc
hb_font_create
(
(struct) font_libraries_raster_oracle_diff.hb_face_t
hb_face_t
*);
void
void font_libraries_raster_oracle_diff.hb_font_destroy(font_libraries_raster_oracle_diff.hb_font_t*) nothrow @nogc
hb_font_destroy
(
(struct) font_libraries_raster_oracle_diff.hb_font_t
hb_font_t
*);
void
void font_libraries_raster_oracle_diff.hb_font_set_scale(font_libraries_raster_oracle_diff.hb_font_t*, int, int) nothrow @nogc
hb_font_set_scale
(
(struct) font_libraries_raster_oracle_diff.hb_font_t
hb_font_t
*, int, int);
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*
font_libraries_raster_oracle_diff.hb_draw_funcs_t* font_libraries_raster_oracle_diff.hb_draw_funcs_create() nothrow @nogc
hb_draw_funcs_create
();
void
void font_libraries_raster_oracle_diff.hb_draw_funcs_destroy(font_libraries_raster_oracle_diff.hb_draw_funcs_t*) nothrow @nogc
hb_draw_funcs_destroy
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*);
void
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_move_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_move_to_func
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*,
(alias) font_libraries_raster_oracle_diff.MoveToFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, void*) nothrow @nogc
MoveToFn
, void*, void*);
void
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_line_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_line_to_func
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*,
(alias) font_libraries_raster_oracle_diff.MoveToFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, void*) nothrow @nogc
MoveToFn
, void*, void*);
void
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_quadratic_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_quadratic_to_func
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*,
(alias) font_libraries_raster_oracle_diff.QuadToFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, void*) nothrow @nogc
QuadToFn
, void*, void*);
void
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_cubic_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_cubic_to_func
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*,
(alias) font_libraries_raster_oracle_diff.CubicToFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, float, float, void*) nothrow @nogc
CubicToFn
, void*, void*);
void
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_close_path_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_close_path_func
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*,
(alias) font_libraries_raster_oracle_diff.CloseFn = extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, void*) nothrow @nogc
CloseFn
, void*, void*);
void
void font_libraries_raster_oracle_diff.hb_font_draw_glyph(font_libraries_raster_oracle_diff.hb_font_t*, uint, font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*) nothrow @nogc
hb_font_draw_glyph
(
(struct) font_libraries_raster_oracle_diff.hb_font_t
hb_font_t
*, uint,
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*);
// freetype.h and ftimage.h. Leading fields only: D never allocates these. struct
(struct) font_libraries_raster_oracle_diff.FT_Generic
FT_Generic
{ void*
(field) void* font_libraries_raster_oracle_diff.FT_Generic.data
data
; void*
(field) void* font_libraries_raster_oracle_diff.FT_Generic.finalizer
finalizer
; }
struct
(struct) font_libraries_raster_oracle_diff.FT_BBox
FT_BBox
{ c_long
(field) long font_libraries_raster_oracle_diff.FT_BBox.xMin
xMin
,
(field) long font_libraries_raster_oracle_diff.FT_BBox.yMin
yMin
,
(field) long font_libraries_raster_oracle_diff.FT_BBox.xMax
xMax
,
(field) long font_libraries_raster_oracle_diff.FT_BBox.yMax
yMax
; }
struct
(struct) font_libraries_raster_oracle_diff.FT_Vector
FT_Vector
{ c_long
(field) long font_libraries_raster_oracle_diff.FT_Vector.x
x
,
(field) long font_libraries_raster_oracle_diff.FT_Vector.y
y
; }
struct
(struct) font_libraries_raster_oracle_diff.FT_Glyph_Metrics
FT_Glyph_Metrics
{ c_long
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.width
width
,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.height
height
,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.horiBearingX
horiBearingX
,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.horiBearingY
horiBearingY
,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.horiAdvance
horiAdvance
,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.vertBearingX
vertBearingX
,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.vertBearingY
vertBearingY
,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.vertAdvance
vertAdvance
;
} struct
(struct) font_libraries_raster_oracle_diff.FT_Bitmap
FT_Bitmap
{ uint
(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.rows
rows
,
(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.width
width
;
int
(field) int font_libraries_raster_oracle_diff.FT_Bitmap.pitch
pitch
;
ubyte*
(field) ubyte* font_libraries_raster_oracle_diff.FT_Bitmap.buffer
buffer
;
ushort
(field) ushort font_libraries_raster_oracle_diff.FT_Bitmap.num_grays
num_grays
;
ubyte
(field) ubyte font_libraries_raster_oracle_diff.FT_Bitmap.pixel_mode
pixel_mode
,
(field) ubyte font_libraries_raster_oracle_diff.FT_Bitmap.palette_mode
palette_mode
;
void*
(field) void* font_libraries_raster_oracle_diff.FT_Bitmap.palette
palette
;
} struct
(struct) font_libraries_raster_oracle_diff.FT_GlyphSlotRec
FT_GlyphSlotRec
{ void*
(field) void* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.library
library
;
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
*
(field) font_libraries_raster_oracle_diff.FT_FaceRec* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.face
face
;
(struct) font_libraries_raster_oracle_diff.FT_GlyphSlotRec
FT_GlyphSlotRec
*
(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.next
next
;
uint
(field) uint font_libraries_raster_oracle_diff.FT_GlyphSlotRec.glyph_index
glyph_index
;
(struct) font_libraries_raster_oracle_diff.FT_Generic
FT_Generic
(field) font_libraries_raster_oracle_diff.FT_Generic font_libraries_raster_oracle_diff.FT_GlyphSlotRec.generic
generic
;
(struct) font_libraries_raster_oracle_diff.FT_Glyph_Metrics
FT_Glyph_Metrics
(field) font_libraries_raster_oracle_diff.FT_Glyph_Metrics font_libraries_raster_oracle_diff.FT_GlyphSlotRec.metrics
metrics
;
c_long
(field) long font_libraries_raster_oracle_diff.FT_GlyphSlotRec.linearHoriAdvance
linearHoriAdvance
,
(field) long font_libraries_raster_oracle_diff.FT_GlyphSlotRec.linearVertAdvance
linearVertAdvance
;
(struct) font_libraries_raster_oracle_diff.FT_Vector
FT_Vector
(field) font_libraries_raster_oracle_diff.FT_Vector font_libraries_raster_oracle_diff.FT_GlyphSlotRec.advance
advance
;
uint
(field) uint font_libraries_raster_oracle_diff.FT_GlyphSlotRec.format
format
;
(struct) font_libraries_raster_oracle_diff.FT_Bitmap
FT_Bitmap
(field) font_libraries_raster_oracle_diff.FT_Bitmap font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap
bitmap
;
int
(field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_left
bitmap_left
,
(field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_top
bitmap_top
;
} struct
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
{ c_long
(field) long font_libraries_raster_oracle_diff.FT_FaceRec.num_faces
num_faces
,
(field) long font_libraries_raster_oracle_diff.FT_FaceRec.face_index
face_index
,
(field) long font_libraries_raster_oracle_diff.FT_FaceRec.face_flags
face_flags
,
(field) long font_libraries_raster_oracle_diff.FT_FaceRec.style_flags
style_flags
,
(field) long font_libraries_raster_oracle_diff.FT_FaceRec.num_glyphs
num_glyphs
;
char*
(field) char* font_libraries_raster_oracle_diff.FT_FaceRec.family_name
family_name
,
(field) char* font_libraries_raster_oracle_diff.FT_FaceRec.style_name
style_name
;
int
(field) int font_libraries_raster_oracle_diff.FT_FaceRec.num_fixed_sizes
num_fixed_sizes
;
void*
(field) void* font_libraries_raster_oracle_diff.FT_FaceRec.available_sizes
available_sizes
;
int
(field) int font_libraries_raster_oracle_diff.FT_FaceRec.num_charmaps
num_charmaps
;
void*
(field) void* font_libraries_raster_oracle_diff.FT_FaceRec.charmaps
charmaps
;
(struct) font_libraries_raster_oracle_diff.FT_Generic
FT_Generic
(field) font_libraries_raster_oracle_diff.FT_Generic font_libraries_raster_oracle_diff.FT_FaceRec.generic
generic
;
(struct) font_libraries_raster_oracle_diff.FT_BBox
FT_BBox
(field) font_libraries_raster_oracle_diff.FT_BBox font_libraries_raster_oracle_diff.FT_FaceRec.bbox
bbox
;
ushort
(field) ushort font_libraries_raster_oracle_diff.FT_FaceRec.units_per_EM
units_per_EM
;
short
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.ascender
ascender
,
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.descender
descender
,
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.height
height
,
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.max_advance_width
max_advance_width
,
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.max_advance_height
max_advance_height
,
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.underline_position
underline_position
,
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.underline_thickness
underline_thickness
;
(struct) font_libraries_raster_oracle_diff.FT_GlyphSlotRec
FT_GlyphSlotRec
*
(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyph
glyph
;
} int
int font_libraries_raster_oracle_diff.FT_Init_FreeType(void** library) nothrow @nogc
FT_Init_FreeType
(void**
(parameter) void** library
library
);
int
int font_libraries_raster_oracle_diff.FT_Done_FreeType(void* library) nothrow @nogc
FT_Done_FreeType
(void*
(parameter) void* library
library
);
int
int font_libraries_raster_oracle_diff.FT_New_Face(void* library, const(char)* path, long index, font_libraries_raster_oracle_diff.FT_FaceRec** face) nothrow @nogc
FT_New_Face
(void*
(parameter) void* library
library
, const(char)*
(parameter) const(char)* path
path
, c_long
(parameter) long index
index
,
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
**
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec** face
face
);
int
int font_libraries_raster_oracle_diff.FT_Done_Face(font_libraries_raster_oracle_diff.FT_FaceRec* face) nothrow @nogc
FT_Done_Face
(
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
*
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* face
face
);
int
int font_libraries_raster_oracle_diff.FT_Set_Pixel_Sizes(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint width, uint height) nothrow @nogc
FT_Set_Pixel_Sizes
(
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
*
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* face
face
, uint
(parameter) uint width
width
, uint
(parameter) uint height
height
);
int
int font_libraries_raster_oracle_diff.FT_Load_Glyph(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint glyph, int flags) nothrow @nogc
FT_Load_Glyph
(
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
*
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* face
face
, uint
(parameter) uint glyph
glyph
, int
(parameter) int flags
flags
);
} enum
(constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_HINTING = 2
FT_LOAD_NO_HINTING
= 1 << 1,
(constant) int font_libraries_raster_oracle_diff.FT_LOAD_RENDER = 4
FT_LOAD_RENDER
= 1 << 2,
(constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_BITMAP = 8
FT_LOAD_NO_BITMAP
= 1 << 3;
enum
(constant) int font_libraries_raster_oracle_diff.FT_PIXEL_MODE_GRAY = 2
FT_PIXEL_MODE_GRAY
= 2;
// --------------------------------------------------------------------------- // The rasterizer of outline-sink-raster.d, emitting 8-bit coverage. // --------------------------------------------------------------------------- struct
(struct) font_libraries_raster_oracle_diff.Rasterizer
Rasterizer
{ int
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
,
(field) int font_libraries_raster_oracle_diff.Rasterizer.h
h
;
float[]
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
;
this(int
(parameter) int w
w
, int
(parameter) int h
h
) { this.
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
=
(parameter) int w
w
; this.
(field) int font_libraries_raster_oracle_diff.Rasterizer.h
h
=
(parameter) int h
h
;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
= new float[(
(parameter) int w
w
+ 2) *
(parameter) int h
h
];
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[] = 0; }
void
void font_libraries_raster_oracle_diff.Rasterizer.line(float x0, float y0, float x1, float y1) pure nothrow @nogc @safe
line
(float
(parameter) float x0
x0
, float
(parameter) float y0
y0
, float
(parameter) float x1
x1
, float
(parameter) float y1
y1
) @safe pure nothrow @nogc
{ if (
(parameter) float y0
y0
==
(parameter) float y1
y1
) return;
float
(local variable) float dir
dir
= 1;
if (
(parameter) float y0
y0
>
(parameter) float y1
y1
) {
(local variable) float dir
dir
= -1;
void font_libraries_raster_oracle_diff.swap(ref float a, ref float b) pure nothrow @nogc @safe
swap
(
(parameter) float x0
x0
,
(parameter) float x1
x1
);
void font_libraries_raster_oracle_diff.swap(ref float a, ref float b) pure nothrow @nogc @safe
swap
(
(parameter) float y0
y0
,
(parameter) float y1
y1
); }
const
(local variable) const(float) dxdy
dxdy
= (
(parameter) float x1
x1
-
(parameter) float x0
x0
) / (
(parameter) float y1
y1
-
(parameter) float y0
y0
);
float
(local variable) float x
x
=
(parameter) float x0
x0
;
if (
(parameter) float y0
y0
< 0)
(local variable) float x
x
-=
(parameter) float y0
y0
*
(local variable) const(float) dxdy
dxdy
;
const
(local variable) const(int) yEnd
yEnd
=
int std.algorithm.comparison.min!(int, int)(int a, int b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the minimum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = min(a, b);
static assert(is(typeof(d) == int));
assert(d == 5);
auto e = min(a, b, c);
static assert(is(typeof(e) == double));
assert(e == 2);
ulong f = 0xffff_ffff_ffff;
const uint g = min(f, 0xffff_0000);
assert(g == 0xffff_0000);
dchar h = 100;
uint i = 101;
static assert(is(typeof(min(h, i)) == dchar));
static assert(is(typeof(min(i, h)) == uint));
assert(min(h, i) == 100);

With arguments of mixed signedness, the return type is the one that can store the lowest values.

int a = -10;
uint f = 10;
static assert(is(typeof(min(a, f)) == int));
assert(min(a, f) == -10);

User-defined types that support comparison with < are supported.

import std.datetime;
assert(min(Date(2012, 12, 21), Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date(2012, 12, 21)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date.min) == Date.min);
assert(min(Date.min, Date(1982, 1, 4)) == Date.min);
assert(min(Date(1982, 1, 4), Date.max) == Date(1982, 1, 4));
assert(min(Date.max, Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date.min, Date.max) == Date.min);
assert(min(Date.max, Date.min) == Date.min);
@paramargs The values to select the minimum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe minimum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the smallest value. If at least one of the arguments is NaN, the result is an unspecified value. See minElement for examples on how to cope with NaNs.@seeminElement
min
(
(field) int font_libraries_raster_oracle_diff.Rasterizer.h
h
, cast(int)
float std.math.rounding.ceil(float x) pure nothrow @nogc @trusted
ceil
(
(parameter) float y1
y1
));
for (int
(local variable) int y
y
=
int std.algorithm.comparison.max!(int, int)(int a, int b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = max(a, b);
assert(is(typeof(d) == int));
assert(d == 6);
auto e = min(a, b, c);
assert(is(typeof(e) == double));
assert(e == 2);
@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(0, cast(int)
(parameter) float y0
y0
); y < yEnd; ++y)
{ const
(local variable) const(int) row
row
=
(local variable) int y
y
* (
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
+ 2);
const
(local variable) const(float) dy
dy
=
float std.algorithm.comparison.min!(float, float)(float a, float b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the minimum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = min(a, b);
static assert(is(typeof(d) == int));
assert(d == 5);
auto e = min(a, b, c);
static assert(is(typeof(e) == double));
assert(e == 2);
ulong f = 0xffff_ffff_ffff;
const uint g = min(f, 0xffff_0000);
assert(g == 0xffff_0000);
dchar h = 100;
uint i = 101;
static assert(is(typeof(min(h, i)) == dchar));
static assert(is(typeof(min(i, h)) == uint));
assert(min(h, i) == 100);

With arguments of mixed signedness, the return type is the one that can store the lowest values.

int a = -10;
uint f = 10;
static assert(is(typeof(min(a, f)) == int));
assert(min(a, f) == -10);

User-defined types that support comparison with < are supported.

import std.datetime;
assert(min(Date(2012, 12, 21), Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date(2012, 12, 21)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date.min) == Date.min);
assert(min(Date.min, Date(1982, 1, 4)) == Date.min);
assert(min(Date(1982, 1, 4), Date.max) == Date(1982, 1, 4));
assert(min(Date.max, Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date.min, Date.max) == Date.min);
assert(min(Date.max, Date.min) == Date.min);
@paramargs The values to select the minimum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe minimum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the smallest value. If at least one of the arguments is NaN, the result is an unspecified value. See minElement for examples on how to cope with NaNs.@seeminElement
min
(
(local variable) int y
y
+ 1.0f,
(parameter) float y1
y1
) -
float std.algorithm.comparison.max!(float, float)(float a, float b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = max(a, b);
assert(is(typeof(d) == int));
assert(d == 6);
auto e = min(a, b, c);
assert(is(typeof(e) == double));
assert(e == 2);
@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(cast(float)
(local variable) int y
y
,
(parameter) float y0
y0
);
const
(local variable) const(float) xnext
xnext
=
(local variable) float x
x
+
(local variable) const(float) dxdy
dxdy
*
(local variable) const(float) dy
dy
;
const
(local variable) const(float) d
d
=
(local variable) const(float) dy
dy
*
(local variable) float dir
dir
;
const
(local variable) const(float) xa
xa
=
float std.algorithm.comparison.min!(float, const(float))(float __param_0, const(float) __param_1) pure nothrow @nogc @safe

Iterates the passed arguments and returns the minimum value.

@paramargs The values to select the minimum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe minimum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the smallest value. If at least one of the arguments is NaN, the result is an unspecified value. See minElement for examples on how to cope with NaNs.@seeminElement
min
(
(local variable) float x
x
,
(local variable) const(float) xnext
xnext
),
(local variable) const(float) xb
xb
=
float std.algorithm.comparison.max!(float, const(float))(float __param_0, const(float) __param_1) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(
(local variable) float x
x
,
(local variable) const(float) xnext
xnext
);
const
(local variable) const(float) xaFloor
xaFloor
=
float std.math.rounding.floor(float x) pure nothrow @nogc @trusted
floor
(
(local variable) const(float) xa
xa
);
const
(local variable) const(int) xai
xai
= cast(int)
(local variable) const(float) xaFloor
xaFloor
;
const
(local variable) const(float) xbCeil
xbCeil
=
float std.math.rounding.ceil(float x) pure nothrow @nogc @trusted
ceil
(
(local variable) const(float) xb
xb
);
const
(local variable) const(int) xbi
xbi
= cast(int)
(local variable) const(float) xbCeil
xbCeil
;
if (
(local variable) const(int) xai
xai
< 0 ||
(local variable) const(int) xbi
xbi
>
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
+ 1) {
(local variable) float x
x
=
(local variable) const(float) xnext
xnext
; continue; }
if (
(local variable) const(int) xbi
xbi
<=
(local variable) const(int) xai
xai
+ 1)
{ const
(local variable) const(float) xmf
xmf
= 0.5f * (
(local variable) float x
x
+
(local variable) const(float) xnext
xnext
) -
(local variable) const(float) xaFloor
xaFloor
;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) const(int) xai
xai
] +=
(local variable) const(float) d
d
-
(local variable) const(float) d
d
*
(local variable) const(float) xmf
xmf
;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) const(int) xai
xai
+ 1] +=
(local variable) const(float) d
d
*
(local variable) const(float) xmf
xmf
;
} else { const
(local variable) const(float) s
s
= 1.0f / (
(local variable) const(float) xb
xb
-
(local variable) const(float) xa
xa
);
const
(local variable) const(float) xaf
xaf
=
(local variable) const(float) xa
xa
-
(local variable) const(float) xaFloor
xaFloor
;
const
(local variable) const(float) a0
a0
= 0.5f *
(local variable) const(float) s
s
* (1 -
(local variable) const(float) xaf
xaf
) * (1 -
(local variable) const(float) xaf
xaf
);
const
(local variable) const(float) xbf
xbf
=
(local variable) const(float) xb
xb
-
(local variable) const(float) xbCeil
xbCeil
+ 1;
const
(local variable) const(float) am
am
= 0.5f *
(local variable) const(float) s
s
*
(local variable) const(float) xbf
xbf
*
(local variable) const(float) xbf
xbf
;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) const(int) xai
xai
] +=
(local variable) const(float) d
d
*
(local variable) const(float) a0
a0
;
if (
(local variable) const(int) xbi
xbi
==
(local variable) const(int) xai
xai
+ 2)
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) const(int) xai
xai
+ 1] +=
(local variable) const(float) d
d
* (1 -
(local variable) const(float) a0
a0
-
(local variable) const(float) am
am
);
else { const
(local variable) const(float) a1
a1
=
(local variable) const(float) s
s
* (1.5f -
(local variable) const(float) xaf
xaf
);
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) const(int) xai
xai
+ 1] +=
(local variable) const(float) d
d
* (
(local variable) const(float) a1
a1
-
(local variable) const(float) a0
a0
);
foreach (
(local variable) int xi
xi
;
(local variable) const(int) xai
xai
+ 2 ..
(local variable) const(int) xbi
xbi
- 1)
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) int xi
xi
] +=
(local variable) const(float) d
d
*
(local variable) const(float) s
s
;
const
(local variable) const(float) a2
a2
=
(local variable) const(float) a1
a1
+ (
(local variable) const(int) xbi
xbi
-
(local variable) const(int) xai
xai
- 3) *
(local variable) const(float) s
s
;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) const(int) xbi
xbi
- 1] +=
(local variable) const(float) d
d
* (1 -
(local variable) const(float) a2
a2
-
(local variable) const(float) am
am
);
}
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) const(int) row
row
+
(local variable) const(int) xbi
xbi
] +=
(local variable) const(float) d
d
*
(local variable) const(float) am
am
;
}
(local variable) float x
x
=
(local variable) const(float) xnext
xnext
;
} } ubyte[]
ubyte[] font_libraries_raster_oracle_diff.Rasterizer.coverage() const pure nothrow @safe
coverage
() const @safe pure nothrow
{ auto
(local variable) ubyte[] c
c
= new ubyte[
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
*
(field) int font_libraries_raster_oracle_diff.Rasterizer.h
h
];
foreach (
(local variable) int y
y
; 0 ..
(field) int font_libraries_raster_oracle_diff.Rasterizer.h
h
)
{ float
(local variable) float sum
sum
= 0;
foreach (
(local variable) int x
x
; 0 ..
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
)
{
(local variable) float sum
sum
+=
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.acc
acc
[
(local variable) int y
y
* (
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
+ 2) +
(local variable) int x
x
];
(local variable) ubyte[] c
c
[
(local variable) int y
y
*
(field) int font_libraries_raster_oracle_diff.Rasterizer.w
w
+
(local variable) int x
x
] = cast(ubyte)(
float std.algorithm.comparison.min!(float, float)(float a, float b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the minimum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = min(a, b);
static assert(is(typeof(d) == int));
assert(d == 5);
auto e = min(a, b, c);
static assert(is(typeof(e) == double));
assert(e == 2);
ulong f = 0xffff_ffff_ffff;
const uint g = min(f, 0xffff_0000);
assert(g == 0xffff_0000);
dchar h = 100;
uint i = 101;
static assert(is(typeof(min(h, i)) == dchar));
static assert(is(typeof(min(i, h)) == uint));
assert(min(h, i) == 100);

With arguments of mixed signedness, the return type is the one that can store the lowest values.

int a = -10;
uint f = 10;
static assert(is(typeof(min(a, f)) == int));
assert(min(a, f) == -10);

User-defined types that support comparison with < are supported.

import std.datetime;
assert(min(Date(2012, 12, 21), Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date(2012, 12, 21)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date.min) == Date.min);
assert(min(Date.min, Date(1982, 1, 4)) == Date.min);
assert(min(Date(1982, 1, 4), Date.max) == Date(1982, 1, 4));
assert(min(Date.max, Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date.min, Date.max) == Date.min);
assert(min(Date.max, Date.min) == Date.min);
@paramargs The values to select the minimum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe minimum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the smallest value. If at least one of the arguments is NaN, the result is an unspecified value. See minElement for examples on how to cope with NaNs.@seeminElement
min
(
float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(
(local variable) float sum
sum
), 1.0f) * 255 + 0.5f);
} } return
(local variable) ubyte[] c
c
;
} } void
void font_libraries_raster_oracle_diff.swap(ref float a, ref float b) pure nothrow @nogc @safe
swap
(ref float
(parameter) float a
a
, ref float
(parameter) float b
b
) @safe pure nothrow @nogc { const
(local variable) const(float) t
t
=
(parameter) float a
a
;
(parameter) float a
a
=
(parameter) float b
b
;
(parameter) float b
b
=
(local variable) const(float) t
t
; }
// --------------------------------------------------------------------------- // The sink: HarfBuzz outline callbacks, flattened into the rasterizer. // Input is in 1/64 px (font scale = ppem * 64), y-up. // --------------------------------------------------------------------------- struct
(struct) font_libraries_raster_oracle_diff.Sink
Sink
{
(struct) font_libraries_raster_oracle_diff.Rasterizer
Rasterizer
*
(field) font_libraries_raster_oracle_diff.Rasterizer* font_libraries_raster_oracle_diff.Sink.r
r
;
float
(field) float font_libraries_raster_oracle_diff.Sink.ox
ox
,
(field) float font_libraries_raster_oracle_diff.Sink.oy
oy
; // origin in raster pixels, y-down
float
(field) float font_libraries_raster_oracle_diff.Sink.k
k
; // raster pixels per output pixel: 1, or 4 when supersampling
bool
(field) bool font_libraries_raster_oracle_diff.Sink.freetypeFlattening
freetypeFlattening
;
float
(field) float font_libraries_raster_oracle_diff.Sink.tolerance
tolerance
; // flattening tolerance in px, when not FreeType's rules
float
(field) float font_libraries_raster_oracle_diff.Sink.px
px
,
(field) float font_libraries_raster_oracle_diff.Sink.py
py
,
(field) float font_libraries_raster_oracle_diff.Sink.startX
startX
,
(field) float font_libraries_raster_oracle_diff.Sink.startY
startY
;
bool
(field) bool font_libraries_raster_oracle_diff.Sink.drew
drew
;
float
float font_libraries_raster_oracle_diff.Sink.sx(float x) const nothrow @nogc
sx
(float
(parameter) float x
x
) const nothrow @nogc =>
(field) float font_libraries_raster_oracle_diff.Sink.ox
ox
+
(parameter) float x
x
/ 64 *
(field) float font_libraries_raster_oracle_diff.Sink.k
k
;
float
float font_libraries_raster_oracle_diff.Sink.sy(float y) const nothrow @nogc
sy
(float
(parameter) float y
y
) const nothrow @nogc =>
(field) float font_libraries_raster_oracle_diff.Sink.oy
oy
-
(parameter) float y
y
/ 64 *
(field) float font_libraries_raster_oracle_diff.Sink.k
k
;
void
void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogc
lineTo
(float
(parameter) float x
x
, float
(parameter) float y
y
) nothrow @nogc
{
(field) font_libraries_raster_oracle_diff.Rasterizer* font_libraries_raster_oracle_diff.Sink.r
r
.
void font_libraries_raster_oracle_diff.Rasterizer.line(float x0, float y0, float x1, float y1) pure nothrow @nogc @safe
line
(
float font_libraries_raster_oracle_diff.Sink.sx(float x) const nothrow @nogc
sx
(
(field) float font_libraries_raster_oracle_diff.Sink.px
px
),
float font_libraries_raster_oracle_diff.Sink.sy(float y) const nothrow @nogc
sy
(
(field) float font_libraries_raster_oracle_diff.Sink.py
py
),
float font_libraries_raster_oracle_diff.Sink.sx(float x) const nothrow @nogc
sx
(
(parameter) float x
x
),
float font_libraries_raster_oracle_diff.Sink.sy(float y) const nothrow @nogc
sy
(
(parameter) float y
y
));
(field) float font_libraries_raster_oracle_diff.Sink.px
px
=
(parameter) float x
x
;
(field) float font_libraries_raster_oracle_diff.Sink.py
py
=
(parameter) float y
y
;
(field) bool font_libraries_raster_oracle_diff.Sink.drew
drew
= true;
} } extern (C) nothrow @nogc void
void font_libraries_raster_oracle_diff.onMove(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float x, float y, void* __param_5) nothrow @nogc
onMove
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*
(parameter) void* d
d
,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*, float
(parameter) float x
x
, float
(parameter) float y
y
, void*)
{ auto
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
= cast(
(struct) font_libraries_raster_oracle_diff.Sink
Sink
*)
(parameter) void* d
d
;
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.px
px
=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.startX
startX
=
(parameter) float x
x
;
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.py
py
=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.startY
startY
=
(parameter) float y
y
;
} extern (C) nothrow @nogc void
void font_libraries_raster_oracle_diff.onLine(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float x, float y, void* __param_5) nothrow @nogc
onLine
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*
(parameter) void* d
d
,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*, float
(parameter) float x
x
, float
(parameter) float y
y
, void*)
{ (cast(
(struct) font_libraries_raster_oracle_diff.Sink
Sink
*)
(parameter) void* d
d
).
void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogc
lineTo
(
(parameter) float x
x
,
(parameter) float y
y
);
} extern (C) nothrow @nogc void
void font_libraries_raster_oracle_diff.onQuad(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float cx, float cy, float x, float y, void* __param_7) nothrow @nogc
onQuad
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*
(parameter) void* d
d
,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*,
float
(parameter) float cx
cx
, float
(parameter) float cy
cy
, float
(parameter) float x
x
, float
(parameter) float y
y
, void*)
{ auto
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
= cast(
(struct) font_libraries_raster_oracle_diff.Sink
Sink
*)
(parameter) void* d
d
;
const
(local variable) const(float) x0
x0
=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.px
px
,
(local variable) const(float) y0
y0
=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.py
py
;
int
(local variable) int n
n
;
if (
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) bool font_libraries_raster_oracle_diff.Sink.freetypeFlattening
freetypeFlattening
)
{ // ftgrays.c gray_render_conic: each bisection quarters the deviation. float
(local variable) float dev
dev
=
float std.algorithm.comparison.max!(float, float)(float a, float b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = max(a, b);
assert(is(typeof(d) == int));
assert(d == 6);
auto e = min(a, b, c);
assert(is(typeof(e) == double));
assert(e == 2);
@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(
float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(
(local variable) const(float) x0
x0
+
(parameter) float x
x
- 2 *
(parameter) float cx
cx
),
float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(
(local variable) const(float) y0
y0
+
(parameter) float y
y
- 2 *
(parameter) float cy
cy
)) / 64 *
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.k
k
;
(local variable) int n
n
= 1;
if (
(local variable) float dev
dev
>= 0.25f)
do {
(local variable) float dev
dev
/= 4;
(local variable) int n
n
*= 2; } while (
(local variable) float dev
dev
> 0.25f);
} else // a quadratic's chord deviates by at most |p0 - 2c + p2| / (4 n^2)
(local variable) int n
n
=
int std.algorithm.comparison.max!(int, int)(int a, int b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = max(a, b);
assert(is(typeof(d) == int));
assert(d == 6);
auto e = min(a, b, c);
assert(is(typeof(e) == double));
assert(e == 2);
@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(1, cast(int)
float std.math.rounding.ceil(float x) pure nothrow @nogc @trusted
ceil
(
float std.math.algebraic.sqrt(float x) pure nothrow @nogc @safe

Compute square root of x.

x sqrt(x) invalid?
-0.0 -0.0 no
<0.0 yes
+ + no
sqrt
(
float std.math.algebraic.hypot!float(const(float) x, const(float) y) pure nothrow @nogc @safe

Calculates the length of the hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of the sums of the squares of x and y:

sqrt(x, 2 + y, 2)

Note that hypot(x, y), hypot(y, x) and hypot(x, -y) are equivalent.

x y hypot(x, y) invalid?
x 0.0 x no
y + no
+ no
y != no

Examples

import std.math.operations : feqrel;
import std.math.traits : isNaN;

assert(hypot(1.0, 1.0).feqrel(1.4142) > 16);
assert(hypot(3.0, 4.0).feqrel(5.0) > 16);
assert(hypot(real.infinity, 1.0L) == real.infinity);
assert(hypot(1.0L, real.infinity) == real.infinity);
assert(hypot(real.infinity, real.nan) == real.infinity);
assert(hypot(real.nan, real.infinity) == real.infinity);
assert(hypot(real.nan, 1.0L).isNaN);
assert(hypot(1.0L, real.nan).isNaN);
hypot
(
(local variable) const(float) x0
x0
- 2 *
(parameter) float cx
cx
+
(parameter) float x
x
,
(local variable) const(float) y0
y0
- 2 *
(parameter) float cy
cy
+
(parameter) float y
y
) / 64 / 4 /
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.tolerance
tolerance
)));
foreach (
(local variable) int i
i
; 1 ..
(local variable) int n
n
+ 1)
{ const
(local variable) const(float) t
t
= float(
(local variable) int i
i
) /
(local variable) int n
n
,
(local variable) const(float) u
u
= 1 -
(local variable) const(float) t
t
;
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogc
lineTo
(
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) x0
x0
+ 2 *
(local variable) const(float) u
u
*
(local variable) const(float) t
t
*
(parameter) float cx
cx
+
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(parameter) float x
x
,
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) y0
y0
+ 2 *
(local variable) const(float) u
u
*
(local variable) const(float) t
t
*
(parameter) float cy
cy
+
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(parameter) float y
y
);
} } extern (C) nothrow @nogc void
void font_libraries_raster_oracle_diff.onCubic(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float c1x, float c1y, float c2x, float c2y, float x, float y, void* __param_9) nothrow @nogc
onCubic
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*
(parameter) void* d
d
,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*,
float
(parameter) float c1x
c1x
, float
(parameter) float c1y
c1y
, float
(parameter) float c2x
c2x
, float
(parameter) float c2y
c2y
, float
(parameter) float x
x
, float
(parameter) float y
y
, void*)
{ auto
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
= cast(
(struct) font_libraries_raster_oracle_diff.Sink
Sink
*)
(parameter) void* d
d
;
const
(local variable) const(float) x0
x0
=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.px
px
,
(local variable) const(float) y0
y0
=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.py
py
;
if (
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) bool font_libraries_raster_oracle_diff.Sink.freetypeFlattening
freetypeFlattening
)
{ // ftgrays.c gray_render_cubic: bisect until the control points lie // within half a pixel of the trisection test. const
(local variable) const(float) limit
limit
= 0.5f * 64 /
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.k
k
;
void
void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @system
split
(float[8]
(parameter) float[8] a
a
, int
(parameter) int depth
depth
)
{ if (
(parameter) int depth
depth
< 16
&& (
float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(2 *
(parameter) float[8] a
a
[0] - 3 *
(parameter) float[8] a
a
[2] +
(parameter) float[8] a
a
[6]) >
(local variable) const(float) limit
limit
||
float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(2 *
(parameter) float[8] a
a
[1] - 3 *
(parameter) float[8] a
a
[3] +
(parameter) float[8] a
a
[7]) >
(local variable) const(float) limit
limit
||
float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(
(parameter) float[8] a
a
[0] - 3 *
(parameter) float[8] a
a
[4] + 2 *
(parameter) float[8] a
a
[6]) >
(local variable) const(float) limit
limit
||
float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(
(parameter) float[8] a
a
[1] - 3 *
(parameter) float[8] a
a
[5] + 2 *
(parameter) float[8] a
a
[7]) >
(local variable) const(float) limit
limit
))
{ const
(local variable) const(float) m01x
m01x
= (
(parameter) float[8] a
a
[0] +
(parameter) float[8] a
a
[2]) / 2,
(local variable) const(float) m01y
m01y
= (
(parameter) float[8] a
a
[1] +
(parameter) float[8] a
a
[3]) / 2;
const
(local variable) const(float) m12x
m12x
= (
(parameter) float[8] a
a
[2] +
(parameter) float[8] a
a
[4]) / 2,
(local variable) const(float) m12y
m12y
= (
(parameter) float[8] a
a
[3] +
(parameter) float[8] a
a
[5]) / 2;
const
(local variable) const(float) m23x
m23x
= (
(parameter) float[8] a
a
[4] +
(parameter) float[8] a
a
[6]) / 2,
(local variable) const(float) m23y
m23y
= (
(parameter) float[8] a
a
[5] +
(parameter) float[8] a
a
[7]) / 2;
const
(local variable) const(float) ax
ax
= (
(local variable) const(float) m01x
m01x
+
(local variable) const(float) m12x
m12x
) / 2,
(local variable) const(float) ay
ay
= (
(local variable) const(float) m01y
m01y
+
(local variable) const(float) m12y
m12y
) / 2;
const
(local variable) const(float) bx
bx
= (
(local variable) const(float) m12x
m12x
+
(local variable) const(float) m23x
m23x
) / 2,
(local variable) const(float) by
by
= (
(local variable) const(float) m12y
m12y
+
(local variable) const(float) m23y
m23y
) / 2;
const
(local variable) const(float) mx
mx
= (
(local variable) const(float) ax
ax
+
(local variable) const(float) bx
bx
) / 2,
(local variable) const(float) my
my
= (
(local variable) const(float) ay
ay
+
(local variable) const(float) by
by
) / 2;
void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @system
split
([
(parameter) float[8] a
a
[0],
(parameter) float[8] a
a
[1],
(local variable) const(float) m01x
m01x
,
(local variable) const(float) m01y
m01y
,
(local variable) const(float) ax
ax
,
(local variable) const(float) ay
ay
,
(local variable) const(float) mx
mx
,
(local variable) const(float) my
my
],
(parameter) int depth
depth
+ 1);
void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @system
split
([
(local variable) const(float) mx
mx
,
(local variable) const(float) my
my
,
(local variable) const(float) bx
bx
,
(local variable) const(float) by
by
,
(local variable) const(float) m23x
m23x
,
(local variable) const(float) m23y
m23y
,
(parameter) float[8] a
a
[6],
(parameter) float[8] a
a
[7]],
(parameter) int depth
depth
+ 1);
} else
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogc
lineTo
(
(parameter) float[8] a
a
[6],
(parameter) float[8] a
a
[7]);
}
void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @system
split
([
(local variable) const(float) x0
x0
,
(local variable) const(float) y0
y0
,
(parameter) float c1x
c1x
,
(parameter) float c1y
c1y
,
(parameter) float c2x
c2x
,
(parameter) float c2y
c2y
,
(parameter) float x
x
,
(parameter) float y
y
], 0);
return; } // A cubic's chord deviates by at most 3/4 of its largest second difference / n^2. const
(local variable) const(float) dd
dd
=
float std.algorithm.comparison.max!(float, float)(float a, float b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = max(a, b);
assert(is(typeof(d) == int));
assert(d == 6);
auto e = min(a, b, c);
assert(is(typeof(e) == double));
assert(e == 2);
@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(
float std.math.algebraic.hypot!float(const(float) x, const(float) y) pure nothrow @nogc @safe

Calculates the length of the hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of the sums of the squares of x and y:

sqrt(x, 2 + y, 2)

Note that hypot(x, y), hypot(y, x) and hypot(x, -y) are equivalent.

x y hypot(x, y) invalid?
x 0.0 x no
y + no
+ no
y != no

Examples

import std.math.operations : feqrel;
import std.math.traits : isNaN;

assert(hypot(1.0, 1.0).feqrel(1.4142) > 16);
assert(hypot(3.0, 4.0).feqrel(5.0) > 16);
assert(hypot(real.infinity, 1.0L) == real.infinity);
assert(hypot(1.0L, real.infinity) == real.infinity);
assert(hypot(real.infinity, real.nan) == real.infinity);
assert(hypot(real.nan, real.infinity) == real.infinity);
assert(hypot(real.nan, 1.0L).isNaN);
assert(hypot(1.0L, real.nan).isNaN);
hypot
(
(local variable) const(float) x0
x0
- 2 *
(parameter) float c1x
c1x
+
(parameter) float c2x
c2x
,
(local variable) const(float) y0
y0
- 2 *
(parameter) float c1y
c1y
+
(parameter) float c2y
c2y
),
float std.math.algebraic.hypot!float(const(float) x, const(float) y) pure nothrow @nogc @safe

Calculates the length of the hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of the sums of the squares of x and y:

sqrt(x, 2 + y, 2)

Note that hypot(x, y), hypot(y, x) and hypot(x, -y) are equivalent.

x y hypot(x, y) invalid?
x 0.0 x no
y + no
+ no
y != no

Examples

import std.math.operations : feqrel;
import std.math.traits : isNaN;

assert(hypot(1.0, 1.0).feqrel(1.4142) > 16);
assert(hypot(3.0, 4.0).feqrel(5.0) > 16);
assert(hypot(real.infinity, 1.0L) == real.infinity);
assert(hypot(1.0L, real.infinity) == real.infinity);
assert(hypot(real.infinity, real.nan) == real.infinity);
assert(hypot(real.nan, real.infinity) == real.infinity);
assert(hypot(real.nan, 1.0L).isNaN);
assert(hypot(1.0L, real.nan).isNaN);
hypot
(
(parameter) float c1x
c1x
- 2 *
(parameter) float c2x
c2x
+
(parameter) float x
x
,
(parameter) float c1y
c1y
- 2 *
(parameter) float c2y
c2y
+
(parameter) float y
y
));
const
(local variable) const(int) n
n
=
int std.algorithm.comparison.max!(int, int)(int a, int b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = max(a, b);
assert(is(typeof(d) == int));
assert(d == 6);
auto e = min(a, b, c);
assert(is(typeof(e) == double));
assert(e == 2);
@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(1, cast(int)
float std.math.rounding.ceil(float x) pure nothrow @nogc @trusted
ceil
(
float std.math.algebraic.sqrt(float x) pure nothrow @nogc @safe

Compute square root of x.

x sqrt(x) invalid?
-0.0 -0.0 no
<0.0 yes
+ + no
sqrt
(
(local variable) const(float) dd
dd
* 0.75f / 64 /
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.tolerance
tolerance
)));
foreach (
(local variable) int i
i
; 1 ..
(local variable) const(int) n
n
+ 1)
{ const
(local variable) const(float) t
t
= float(
(local variable) int i
i
) /
(local variable) const(int) n
n
,
(local variable) const(float) u
u
= 1 -
(local variable) const(float) t
t
;
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogc
lineTo
(
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) x0
x0
+ 3 *
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) t
t
*
(parameter) float c1x
c1x
+ 3 *
(local variable) const(float) u
u
*
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(parameter) float c2x
c2x
+
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(parameter) float x
x
,
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) y0
y0
+ 3 *
(local variable) const(float) u
u
*
(local variable) const(float) u
u
*
(local variable) const(float) t
t
*
(parameter) float c1y
c1y
+ 3 *
(local variable) const(float) u
u
*
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(parameter) float c2y
c2y
+
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(local variable) const(float) t
t
*
(parameter) float y
y
);
} } extern (C) nothrow @nogc void
void font_libraries_raster_oracle_diff.onClose(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, void* __param_3) nothrow @nogc
onClose
(
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*, void*
(parameter) void* d
d
,
(struct) font_libraries_raster_oracle_diff.hb_draw_state_t
hb_draw_state_t
*, void*)
{ auto
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
= cast(
(struct) font_libraries_raster_oracle_diff.Sink
Sink
*)
(parameter) void* d
d
;
if (
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.px
px
!=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.startX
startX
||
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.py
py
!=
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.startY
startY
)
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogc
lineTo
(
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.startX
startX
,
(local variable) font_libraries_raster_oracle_diff.Sink* s
s
.
(field) float font_libraries_raster_oracle_diff.Sink.startY
startY
);
} // --------------------------------------------------------------------------- /// Per glyph, whether `glyf` sets OVERLAP_SIMPLE or OVERLAP_COMPOUND. /// Empty for a face without `glyf` (CFF), which has no such flag. bool[]
bool[] font_libraries_raster_oracle_diff.overlapFlags(const(ubyte)[] d) pure @safe

Per glyph, whether glyf sets OVERLAP_SIMPLE or OVERLAP_COMPOUND. Empty for a face without glyf (CFF), which has no such flag.

overlapFlags
(const(ubyte)[]
(parameter) const(ubyte)[] d
d
) @safe pure
{ uint
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(
(alias) object.size_t = ulong
size_t
(parameter) ulong o
o
) =>
(parameter) ulong o
o
+ 2 <=
(parameter) const(ubyte)[] d
d
.
(field) ulong const(ubyte)[].length
length
? (
(parameter) const(ubyte)[] d
d
[
(parameter) ulong o
o
] << 8) |
(parameter) const(ubyte)[] d
d
[
(parameter) ulong o
o
+ 1] : 0;
uint
uint font_libraries_raster_oracle_diff.overlapFlags.u32(ulong o) pure nothrow @nogc @safe
u32
(
(alias) object.size_t = ulong
size_t
(parameter) ulong o
o
) =>
(parameter) ulong o
o
+ 4 <=
(parameter) const(ubyte)[] d
d
.
(field) ulong const(ubyte)[].length
length
? (uint(
(parameter) const(ubyte)[] d
d
[
(parameter) ulong o
o
]) << 24) | (
(parameter) const(ubyte)[] d
d
[
(parameter) ulong o
o
+ 1] << 16) | (
(parameter) const(ubyte)[] d
d
[
(parameter) ulong o
o
+ 2] << 8) |
(parameter) const(ubyte)[] d
d
[
(parameter) ulong o
o
+ 3] : 0;
(alias) object.size_t = ulong
size_t
(local variable) ulong head
head
,
(local variable) ulong loca
loca
,
(local variable) ulong glyf
glyf
,
(local variable) ulong maxp
maxp
;
foreach (
(local variable) uint i
i
; 0 ..
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(4))
{ const
(local variable) const(uint) r
r
= 12 +
(local variable) uint i
i
* 16,
(local variable) const(uint) off
off
=
uint font_libraries_raster_oracle_diff.overlapFlags.u32(ulong o) pure nothrow @nogc @safe
u32
(
(local variable) const(uint) r
r
+ 8);
switch (cast(const(char)[])
(parameter) const(ubyte)[] d
d
[
(local variable) const(uint) r
r
..
(local variable) const(uint) r
r
+ 4])
{ case "head":
(local variable) ulong head
head
=
(local variable) const(uint) off
off
; break;
case "loca":
(local variable) ulong loca
loca
=
(local variable) const(uint) off
off
; break;
case "glyf":
(local variable) ulong glyf
glyf
=
(local variable) const(uint) off
off
; break;
case "maxp":
(local variable) ulong maxp
maxp
=
(local variable) const(uint) off
off
; break;
default: break; } } if (!
(local variable) ulong glyf
glyf
|| !
(local variable) ulong loca
loca
|| !
(local variable) ulong head
head
|| !
(local variable) ulong maxp
maxp
)
return null; const
(local variable) const(bool) longOffsets
longOffsets
=
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(
(local variable) ulong head
head
+ 50) == 1;
(alias) object.size_t = ulong
size_t
ulong font_libraries_raster_oracle_diff.overlapFlags.offset(ulong g) pure nothrow @nogc @safe
offset
(
(alias) object.size_t = ulong
size_t
(parameter) ulong g
g
) =>
(local variable) ulong glyf
glyf
+ (
(local variable) const(bool) longOffsets
longOffsets
?
uint font_libraries_raster_oracle_diff.overlapFlags.u32(ulong o) pure nothrow @nogc @safe
u32
(
(local variable) ulong loca
loca
+
(parameter) ulong g
g
* 4) :
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(
(local variable) ulong loca
loca
+
(parameter) ulong g
g
* 2) * 2);
auto
(local variable) bool[] flags
flags
= new bool[
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(
(local variable) ulong maxp
maxp
+ 4)];
foreach (
(parameter) ulong g
g
, ref
(parameter) bool flag
flag
;
(local variable) bool[] flags
flags
)
{ const
(local variable) const(ulong) start
start
=
ulong font_libraries_raster_oracle_diff.overlapFlags.offset(ulong g) pure nothrow @nogc @safe
offset
(
(local variable) ulong g
g
);
if (
ulong font_libraries_raster_oracle_diff.overlapFlags.offset(ulong g) pure nothrow @nogc @safe
offset
(
(local variable) ulong g
g
+ 1) <=
(local variable) const(ulong) start
start
)
continue; const
(local variable) const(short) contours
contours
= cast(short)
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(
(local variable) const(ulong) start
start
);
if (
(local variable) const(short) contours
contours
> 0)
{ const
(local variable) const(ulong) instructions
instructions
=
(local variable) const(ulong) start
start
+ 10 +
(local variable) const(short) contours
contours
* 2;
const
(local variable) const(ulong) firstFlag
firstFlag
=
(local variable) const(ulong) instructions
instructions
+ 2 +
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(
(local variable) const(ulong) instructions
instructions
);
(local variable) bool flag
flag
=
(local variable) const(ulong) firstFlag
firstFlag
<
(parameter) const(ubyte)[] d
d
.
(field) ulong const(ubyte)[].length
length
&& (
(parameter) const(ubyte)[] d
d
[
(local variable) const(ulong) firstFlag
firstFlag
] & 0x40) != 0;
} else if (
(local variable) const(short) contours
contours
< 0)
for (
(alias) object.size_t = ulong
size_t
(local variable) ulong p
p
=
(local variable) const(ulong) start
start
+ 10;;)
{ const
(local variable) const(uint) f
f
=
uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safe
u16
(
(local variable) ulong p
p
);
if (
(local variable) const(uint) f
f
& 0x0400)
{
(local variable) bool flag
flag
= true;
break; } if (!(
(local variable) const(uint) f
f
& 0x20)) // MORE_COMPONENTS
break;
(local variable) ulong p
p
+= 4 + ((
(local variable) const(uint) f
f
& 1) ? 4 : 2) + ((
(local variable) const(uint) f
f
& 8) ? 2 : (
(local variable) const(uint) f
f
& 0x40) ? 4 : (
(local variable) const(uint) f
f
& 0x80) ? 8 : 0);
} } return
(local variable) bool[] flags
flags
;
} ubyte
ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safe
percentile
(const(ubyte)[]
(parameter) const(ubyte)[] sorted
sorted
, double
(parameter) double p
p
) @safe pure nothrow @nogc
=>
(parameter) const(ubyte)[] sorted
sorted
.
(field) ulong const(ubyte)[].length
length
?
(parameter) const(ubyte)[] sorted
sorted
[
ulong std.algorithm.comparison.min!(ulong, ulong)(ulong a, ulong b) pure nothrow @nogc @safe

Iterates the passed arguments and returns the minimum value.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = min(a, b);
static assert(is(typeof(d) == int));
assert(d == 5);
auto e = min(a, b, c);
static assert(is(typeof(e) == double));
assert(e == 2);
ulong f = 0xffff_ffff_ffff;
const uint g = min(f, 0xffff_0000);
assert(g == 0xffff_0000);
dchar h = 100;
uint i = 101;
static assert(is(typeof(min(h, i)) == dchar));
static assert(is(typeof(min(i, h)) == uint));
assert(min(h, i) == 100);

With arguments of mixed signedness, the return type is the one that can store the lowest values.

int a = -10;
uint f = 10;
static assert(is(typeof(min(a, f)) == int));
assert(min(a, f) == -10);

User-defined types that support comparison with < are supported.

import std.datetime;
assert(min(Date(2012, 12, 21), Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date(2012, 12, 21)) == Date(1982, 1, 4));
assert(min(Date(1982, 1, 4), Date.min) == Date.min);
assert(min(Date.min, Date(1982, 1, 4)) == Date.min);
assert(min(Date(1982, 1, 4), Date.max) == Date(1982, 1, 4));
assert(min(Date.max, Date(1982, 1, 4)) == Date(1982, 1, 4));
assert(min(Date.min, Date.max) == Date.min);
assert(min(Date.max, Date.min) == Date.min);
@paramargs The values to select the minimum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe minimum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the smallest value. If at least one of the arguments is NaN, the result is an unspecified value. See minElement for examples on how to cope with NaNs.@seeminElement
min
(
(parameter) const(ubyte)[] sorted
sorted
.
(field) ulong const(ubyte)[].length
length
- 1, cast(
(alias) object.size_t = ulong
size_t
)(
(parameter) double p
p
/ 100 *
(parameter) const(ubyte)[] sorted
sorted
.
(field) ulong const(ubyte)[].length
length
))] : 0;
/// What a row compares, and against what. enum
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
{
(enum value) font_libraries_raster_oracle_diff.Mode.production = 0

D, 0.02 px flattening, FreeType's overlap rule — vs FreeType

production
, /// D, 0.02 px flattening, FreeType's overlap rule — vs FreeType
(enum value) font_libraries_raster_oracle_diff.Mode.ftFlatten = 1

D with FreeType's flattening rules — vs FreeType

ftFlatten
, /// D with FreeType's flattening rules — vs FreeType
(enum value) font_libraries_raster_oracle_diff.Mode.fineReference = 2

D at 0.02 px — vs D at 0.001 px: the flattening error alone

fineReference
, /// D at 0.02 px — vs D at 0.001 px: the flattening error alone
(enum value) font_libraries_raster_oracle_diff.Mode.unflagged = 3

D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag

unflagged
, /// D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag
} /// A glyph rendered by the D rasterizer into a `w`×`h` frame whose pixel /// (`margin`, `margin`) is FreeType's bitmap origin; `ss` = 4 supersamples. ubyte[]
ubyte[] font_libraries_raster_oracle_diff.renderOurs(font_libraries_raster_oracle_diff.hb_font_t* font, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, uint gid, uint w, uint h, int left, int top, int ss, bool freetypeFlattening, float tolerance, out bool drew)

A glyph rendered by the D rasterizer into a w×h frame whose pixel (margin, margin) is FreeType's bitmap origin; ss = 4 supersamples.

renderOurs
(
(struct) font_libraries_raster_oracle_diff.hb_font_t
hb_font_t
*
(parameter) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, uint
(parameter) uint gid
gid
, uint
(parameter) uint w
w
, uint
(parameter) uint h
h
,
int
(parameter) int left
left
, int
(parameter) int top
top
, int
(parameter) int ss
ss
, bool
(parameter) bool freetypeFlattening
freetypeFlattening
, float
(parameter) float tolerance
tolerance
, out bool
(parameter) bool drew
drew
)
{ auto
(local variable) font_libraries_raster_oracle_diff.Rasterizer* r
r
= new
(struct) font_libraries_raster_oracle_diff.Rasterizer
Rasterizer
(
(parameter) uint w
w
*
(parameter) int ss
ss
,
(parameter) uint h
h
*
(parameter) int ss
ss
);
auto
(local variable) font_libraries_raster_oracle_diff.Sink sink
sink
=
(struct) font_libraries_raster_oracle_diff.Sink
Sink
(
(local variable) font_libraries_raster_oracle_diff.Rasterizer* r
r
,
(parameter) int ss
ss
* (
(constant) int font_libraries_raster_oracle_diff.margin = 4
margin
-
(parameter) int left
left
),
(parameter) int ss
ss
* (
(constant) int font_libraries_raster_oracle_diff.margin = 4
margin
+
(parameter) int top
top
),
(parameter) int ss
ss
,
(parameter) bool freetypeFlattening
freetypeFlattening
,
(parameter) float tolerance
tolerance
);
void font_libraries_raster_oracle_diff.hb_font_draw_glyph(font_libraries_raster_oracle_diff.hb_font_t*, uint, font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*) nothrow @nogc
hb_font_draw_glyph
(
(parameter) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(parameter) uint gid
gid
,
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, &
(local variable) font_libraries_raster_oracle_diff.Sink sink
sink
);
(parameter) bool drew
drew
=
(local variable) font_libraries_raster_oracle_diff.Sink sink
sink
.
(field) bool font_libraries_raster_oracle_diff.Sink.drew
drew
;
const
(local variable) const(ubyte[]) fine
fine
=
(local variable) font_libraries_raster_oracle_diff.Rasterizer* r
r
.
ubyte[] font_libraries_raster_oracle_diff.Rasterizer.coverage() const pure nothrow @safe
coverage
();
if (
(parameter) int ss
ss
== 1)
return
(local variable) const(ubyte[]) fine
fine
.
ubyte[] object.dup!ubyte(const(ubyte)[] a) pure nothrow @property @safe
dup
;
auto
(local variable) ubyte[] out_
out_
= new ubyte[
(parameter) uint w
w
*
(parameter) uint h
h
];
foreach (
(local variable) uint y
y
; 0 ..
(parameter) uint h
h
)
foreach (
(local variable) uint x
x
; 0 ..
(parameter) uint w
w
)
{ uint
(local variable) uint sum
sum
;
foreach (
(local variable) int j
j
; 0 ..
(parameter) int ss
ss
)
foreach (
(local variable) int i
i
; 0 ..
(parameter) int ss
ss
)
(local variable) uint sum
sum
+=
(local variable) const(ubyte[]) fine
fine
[(
(local variable) uint y
y
*
(parameter) int ss
ss
+
(local variable) int j
j
) *
(parameter) uint w
w
*
(parameter) int ss
ss
+
(local variable) uint x
x
*
(parameter) int ss
ss
+
(local variable) int i
i
];
(local variable) ubyte[] out_
out_
[
(local variable) uint y
y
*
(parameter) uint w
w
+
(local variable) uint x
x
] = cast(ubyte)((
(local variable) uint sum
sum
+
(parameter) int ss
ss
*
(parameter) int ss
ss
/ 2) / (
(parameter) int ss
ss
*
(parameter) int ss
ss
));
} return
(local variable) ubyte[] out_
out_
;
} enum
(constant) int font_libraries_raster_oracle_diff.margin = 4
margin
= 4;
/// One face at one size in one mode: per-pixel differences over pixels either /// side inks, and each glyph's largest difference. void
void font_libraries_raster_oracle_diff.compare(font_libraries_raster_oracle_diff.FT_FaceRec* ft, font_libraries_raster_oracle_diff.hb_font_t* font, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, const(bool)[] overlap, uint glyphs, int ppem, font_libraries_raster_oracle_diff.Mode mode)

One face at one size in one mode: per-pixel differences over pixels either side inks, and each glyph's largest difference.

compare
(
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
*
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
,
(struct) font_libraries_raster_oracle_diff.hb_font_t
hb_font_t
*
(parameter) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, const(bool)[]
(parameter) const(bool)[] overlap
overlap
,
uint
(parameter) uint glyphs
glyphs
, int
(parameter) int ppem
ppem
,
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
(parameter) font_libraries_raster_oracle_diff.Mode mode
mode
)
{
void font_libraries_raster_oracle_diff.hb_font_set_scale(font_libraries_raster_oracle_diff.hb_font_t*, int, int) nothrow @nogc
hb_font_set_scale
(
(parameter) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(parameter) int ppem
ppem
* 64,
(parameter) int ppem
ppem
* 64);
int font_libraries_raster_oracle_diff.FT_Set_Pixel_Sizes(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint width, uint height) nothrow @nogc
FT_Set_Pixel_Sizes
(
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
, 0,
(parameter) int ppem
ppem
);
ubyte[]
(local variable) ubyte[] pixels
pixels
,
(local variable) ubyte[] glyphMax
glyphMax
;
foreach (
(local variable) uint gid
gid
; 0 ..
(parameter) uint glyphs
glyphs
)
{ if (
int font_libraries_raster_oracle_diff.FT_Load_Glyph(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint glyph, int flags) nothrow @nogc
FT_Load_Glyph
(
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
,
(local variable) uint gid
gid
,
(constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_HINTING = 2
FT_LOAD_NO_HINTING
|
(constant) int font_libraries_raster_oracle_diff.FT_LOAD_RENDER = 4
FT_LOAD_RENDER
|
(constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_BITMAP = 8
FT_LOAD_NO_BITMAP
) != 0)
continue; const
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
=
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
.
(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyph
glyph
.
(field) font_libraries_raster_oracle_diff.FT_Bitmap font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap
bitmap
;
if (
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) ubyte font_libraries_raster_oracle_diff.FT_Bitmap.pixel_mode
pixel_mode
!=
(constant) int font_libraries_raster_oracle_diff.FT_PIXEL_MODE_GRAY = 2
FT_PIXEL_MODE_GRAY
)
continue; const
(local variable) const(bool) flagged
flagged
=
(local variable) uint gid
gid
<
(parameter) const(bool)[] overlap
overlap
.
(field) ulong const(bool)[].length
length
&&
(parameter) const(bool)[] overlap
overlap
[
(local variable) uint gid
gid
];
if (
(parameter) font_libraries_raster_oracle_diff.Mode mode
mode
==
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.unflagged = 3

D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag

unflagged
&&
(local variable) const(bool) flagged
flagged
)
continue; const
(local variable) const(uint) w
w
=
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.width
width
+ 2 *
(constant) int font_libraries_raster_oracle_diff.margin = 4
margin
,
(local variable) const(uint) h
h
=
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.rows
rows
+ 2 *
(constant) int font_libraries_raster_oracle_diff.margin = 4
margin
;
const
(local variable) const(int) left
left
=
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
.
(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyph
glyph
.
(field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_left
bitmap_left
,
(local variable) const(int) top
top
=
(parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
.
(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyph
glyph
.
(field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_top
bitmap_top
;
bool
(local variable) bool drew
drew
,
(local variable) bool unused
unused
;
const
(local variable) const(ubyte[]) ours
ours
=
ubyte[] font_libraries_raster_oracle_diff.renderOurs(font_libraries_raster_oracle_diff.hb_font_t* font, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, uint gid, uint w, uint h, int left, int top, int ss, bool freetypeFlattening, float tolerance, out bool drew)

A glyph rendered by the D rasterizer into a w×h frame whose pixel (margin, margin) is FreeType's bitmap origin; ss = 4 supersamples.

renderOurs
(
(parameter) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
,
(local variable) uint gid
gid
,
(local variable) const(uint) w
w
,
(local variable) const(uint) h
h
,
(local variable) const(int) left
left
,
(local variable) const(int) top
top
,
(local variable) const(bool) flagged
flagged
? 4 : 1,
(parameter) font_libraries_raster_oracle_diff.Mode mode
mode
==
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.ftFlatten = 1

D with FreeType's flattening rules — vs FreeType

ftFlatten
, 0.02f,
(local variable) bool drew
drew
);
if (!
(local variable) bool drew
drew
&&
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.width
width
== 0)
continue; ubyte[]
(local variable) ubyte[] reference
reference
;
if (
(parameter) font_libraries_raster_oracle_diff.Mode mode
mode
==
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.fineReference = 2

D at 0.02 px — vs D at 0.001 px: the flattening error alone

fineReference
)
(local variable) ubyte[] reference
reference
=
ubyte[] font_libraries_raster_oracle_diff.renderOurs(font_libraries_raster_oracle_diff.hb_font_t* font, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, uint gid, uint w, uint h, int left, int top, int ss, bool freetypeFlattening, float tolerance, out bool drew)

A glyph rendered by the D rasterizer into a w×h frame whose pixel (margin, margin) is FreeType's bitmap origin; ss = 4 supersamples.

renderOurs
(
(parameter) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
,
(local variable) uint gid
gid
,
(local variable) const(uint) w
w
,
(local variable) const(uint) h
h
,
(local variable) const(int) left
left
,
(local variable) const(int) top
top
,
(local variable) const(bool) flagged
flagged
? 4 : 1, false, 0.001f,
(local variable) bool unused
unused
);
else if (
(parameter) font_libraries_raster_oracle_diff.Mode mode
mode
==
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.unflagged = 3

D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag

unflagged
)
(local variable) ubyte[] reference
reference
=
ubyte[] font_libraries_raster_oracle_diff.renderOurs(font_libraries_raster_oracle_diff.hb_font_t* font, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, uint gid, uint w, uint h, int left, int top, int ss, bool freetypeFlattening, float tolerance, out bool drew)

A glyph rendered by the D rasterizer into a w×h frame whose pixel (margin, margin) is FreeType's bitmap origin; ss = 4 supersamples.

renderOurs
(
(parameter) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
,
(local variable) uint gid
gid
,
(local variable) const(uint) w
w
,
(local variable) const(uint) h
h
,
(local variable) const(int) left
left
,
(local variable) const(int) top
top
, 4, false, 0.02f,
(local variable) bool unused
unused
);
else {
(local variable) ubyte[] reference
reference
= new ubyte[
(local variable) const(uint) w
w
*
(local variable) const(uint) h
h
];
foreach (
(local variable) uint fy
fy
; 0 ..
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.rows
rows
)
foreach (
(local variable) uint fx
fx
; 0 ..
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.width
width
)
(local variable) ubyte[] reference
reference
[(
(local variable) uint fy
fy
+
(constant) int font_libraries_raster_oracle_diff.margin = 4
margin
) *
(local variable) const(uint) w
w
+
(local variable) uint fx
fx
+
(constant) int font_libraries_raster_oracle_diff.margin = 4
margin
] =
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) ubyte* font_libraries_raster_oracle_diff.FT_Bitmap.buffer
buffer
[
(local variable) uint fy
fy
*
(local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bm
bm
.
(field) int font_libraries_raster_oracle_diff.FT_Bitmap.pitch
pitch
+
(local variable) uint fx
fx
];
} ubyte
(local variable) ubyte worst
worst
;
foreach (
(local variable) uint i
i
; 0 ..
(local variable) const(uint) w
w
*
(local variable) const(uint) h
h
)
{ if (!
(local variable) const(ubyte[]) ours
ours
[
(local variable) uint i
i
] && !
(local variable) ubyte[] reference
reference
[
(local variable) uint i
i
])
continue; const
(local variable) const(ubyte) diff
diff
= cast(ubyte)
int std.math.algebraic.abs!int(int x) pure nothrow @nogc @safe

Calculates the absolute value of a number.

Limitations

When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.

Examples

import std.math.traits : isIdentical, isNaN;

assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(23u) == 23u);
@paramNum (template parameter) type of number@paramx real number value@returnsThe absolute value of the number. If floating-point or integral, the return type will be the same as the input.
abs
(int(
(local variable) const(ubyte[]) ours
ours
[
(local variable) uint i
i
]) - int(
(local variable) ubyte[] reference
reference
[
(local variable) uint i
i
]));
(local variable) ubyte[] pixels
pixels
~=
(local variable) const(ubyte) diff
diff
;
(local variable) ubyte worst
worst
=
ubyte std.algorithm.comparison.max!(ubyte, const(ubyte))(ubyte __param_0, const(ubyte) __param_1) pure nothrow @nogc @safe

Iterates the passed arguments and returns the maximum value.

@paramargs The values to select the maximum from. At least two arguments must be passed, and they must be comparable with <.@returnsThe maximum of the passed-in values. The type of the returned value is the type among the passed arguments that is able to store the largest value. If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.@seemaxElement
max
(
(local variable) ubyte worst
worst
,
(local variable) const(ubyte) diff
diff
);
}
(local variable) ubyte[] glyphMax
glyphMax
~=
(local variable) ubyte worst
worst
;
}
(local variable) ubyte[] pixels
pixels
.
std.range.SortedRange!(ubyte[], "a < b", SortedRangeOptions.assumeSorted) std.algorithm.sorting.sort!("a < b", SwapStrategy.unstable, ubyte[])(ubyte[] r) pure nothrow @nogc @safe

Sorts a random-access range according to the predicate less.

Performs O(r.length * log(r.length)) evaluations of less. If less involves expensive computations on the sort key, it may be worthwhile to use schwartzSort instead.

Stable sorting requires hasAssignableElements!Range to be true.

sort returns a SortedRange over the original range, allowing functions that can take advantage of sorted data to know that the range is sorted and adjust accordingly. The SortedRange is a wrapper around the original range, so both it and the original range are sorted. Other functions can't know that the original range has been sorted, but they can know that SortedRange has been sorted.

Preconditions

The predicate is expected to satisfy certain rules in order for sort to behave as expected - otherwise, the program may fail on certain inputs (but not others) when not compiled in release mode, due to the cursory assumeSorted check. Specifically, sort expects less(a,b) && less(b,c) to imply less(a,c) (transitivity), and, conversely, !less(a,b) && !less(b,c) to imply !less(a,c). Note that the default predicate ("a < b") does not always satisfy these conditions for floating point types, because the expression will always be false when either a or b is NaN. Use cmp instead.

Algorithms

Introsort is used for unstable sorting and Timsort is used for stable sorting. Each algorithm has benefits beyond stability. Introsort is generally faster but Timsort may achieve greater speeds on data with low entropy or if predicate calls are expensive. Introsort performs no allocations whereas Timsort will perform one or more allocations per call. Both algorithms have O(n log n) worst-case time complexity.

Examples

int[] array = [ 1, 2, 3, 4 ];

// sort in descending order
array.sort!("a > b");
assert(array == [ 4, 3, 2, 1 ]);

// sort in ascending order
array.sort();
assert(array == [ 1, 2, 3, 4 ]);

// sort with reusable comparator and chain
alias myComp = (x, y) => x > y;
assert(array.sort!(myComp).release == [ 4, 3, 2, 1 ]);
// Showcase stable sorting
import std.algorithm.mutation : SwapStrategy;
string[] words = [ "aBc", "a", "abc", "b", "ABC", "c" ];
sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable)(words);
assert(words == [ "a", "aBc", "abc", "ABC", "b", "c" ]);
// Sorting floating-point numbers in presence of NaN
double[] numbers = [-0.0, 3.0, -2.0, double.nan, 0.0, -double.nan];

import std.algorithm.comparison : equal;
import std.math.operations : cmp;
import std.math.traits : isIdentical;

sort!((a, b) => cmp(a, b) < 0)(numbers);

double[] sorted = [-double.nan, -2.0, -0.0, 0.0, 3.0, double.nan];
assert(numbers.equal!isIdentical(sorted));
@paramless The predicate to sort by.@paramss The swapping strategy to use.@paramr The range to sort.@returnsThe initial range wrapped as a SortedRange with the predicate binaryFun!less.@see

assumeSorted

SortedRange

SwapStrategy

binaryFun

sort
();
(local variable) ubyte[] glyphMax
glyphMax
.
std.range.SortedRange!(ubyte[], "a < b", SortedRangeOptions.assumeSorted) std.algorithm.sorting.sort!("a < b", SwapStrategy.unstable, ubyte[])(ubyte[] r) pure nothrow @nogc @safe

Sorts a random-access range according to the predicate less.

Performs O(r.length * log(r.length)) evaluations of less. If less involves expensive computations on the sort key, it may be worthwhile to use schwartzSort instead.

Stable sorting requires hasAssignableElements!Range to be true.

sort returns a SortedRange over the original range, allowing functions that can take advantage of sorted data to know that the range is sorted and adjust accordingly. The SortedRange is a wrapper around the original range, so both it and the original range are sorted. Other functions can't know that the original range has been sorted, but they can know that SortedRange has been sorted.

Preconditions

The predicate is expected to satisfy certain rules in order for sort to behave as expected - otherwise, the program may fail on certain inputs (but not others) when not compiled in release mode, due to the cursory assumeSorted check. Specifically, sort expects less(a,b) && less(b,c) to imply less(a,c) (transitivity), and, conversely, !less(a,b) && !less(b,c) to imply !less(a,c). Note that the default predicate ("a < b") does not always satisfy these conditions for floating point types, because the expression will always be false when either a or b is NaN. Use cmp instead.

Algorithms

Introsort is used for unstable sorting and Timsort is used for stable sorting. Each algorithm has benefits beyond stability. Introsort is generally faster but Timsort may achieve greater speeds on data with low entropy or if predicate calls are expensive. Introsort performs no allocations whereas Timsort will perform one or more allocations per call. Both algorithms have O(n log n) worst-case time complexity.

Examples

int[] array = [ 1, 2, 3, 4 ];

// sort in descending order
array.sort!("a > b");
assert(array == [ 4, 3, 2, 1 ]);

// sort in ascending order
array.sort();
assert(array == [ 1, 2, 3, 4 ]);

// sort with reusable comparator and chain
alias myComp = (x, y) => x > y;
assert(array.sort!(myComp).release == [ 4, 3, 2, 1 ]);
// Showcase stable sorting
import std.algorithm.mutation : SwapStrategy;
string[] words = [ "aBc", "a", "abc", "b", "ABC", "c" ];
sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable)(words);
assert(words == [ "a", "aBc", "abc", "ABC", "b", "c" ]);
// Sorting floating-point numbers in presence of NaN
double[] numbers = [-0.0, 3.0, -2.0, double.nan, 0.0, -double.nan];

import std.algorithm.comparison : equal;
import std.math.operations : cmp;
import std.math.traits : isIdentical;

sort!((a, b) => cmp(a, b) < 0)(numbers);

double[] sorted = [-double.nan, -2.0, -0.0, 0.0, 3.0, double.nan];
assert(numbers.equal!isIdentical(sorted));
@paramless The predicate to sort by.@paramss The swapping strategy to use.@paramr The range to sort.@returnsThe initial range wrapped as a SortedRange with the predicate binaryFun!less.@see

assumeSorted

SortedRange

SwapStrategy

binaryFun

sort
();
void std.stdio.writefln!(char, font_libraries_raster_oracle_diff.Mode, int, ulong, ubyte, ubyte, int, ubyte, ubyte, ulong)(in char[] fmt, font_libraries_raster_oracle_diff.Mode __param_1, int __param_2, ulong __param_3, ubyte __param_4, ubyte __param_5, int __param_6, ubyte __param_7, ubyte __param_8, ulong __param_9) @safe

Equivalent to writef(fmt, args, '\n').

writefln
(" %-14s %2d px %6d glyphs pixel p50 %3d p99 %3d max %3d glyph max p50 %3d p99 %3d >32: %d",
(parameter) font_libraries_raster_oracle_diff.Mode mode
mode
,
(parameter) int ppem
ppem
,
(local variable) ubyte[] glyphMax
glyphMax
.
(field) ulong ubyte[].length
length
,
(local variable) ubyte[] pixels
pixels
.
ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safe
percentile
(50),
(local variable) ubyte[] pixels
pixels
.
ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safe
percentile
(99),
(local variable) ubyte[] pixels
pixels
.
(field) ulong ubyte[].length
length
?
(local variable) ubyte[] pixels
pixels
[$ - 1] : 0,
(local variable) ubyte[] glyphMax
glyphMax
.
ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safe
percentile
(50),
(local variable) ubyte[] glyphMax
glyphMax
.
ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safe
percentile
(99),
(local variable) ubyte[] glyphMax
glyphMax
.
ulong font_libraries_raster_oracle_diff.compare.count!((m) => m > 32, ubyte[])(ubyte[] haystack) pure nothrow @nogc @safe

Counts all elements or elements satisfying a predicate in haystack.

The first overload counts each element e in haystack for which pred(e) is true. Performs O(haystack.length) evaluations of pred.

The second overload counts the number of elements in a range. If the given range has the length property, that is returned right away, otherwise performs O(haystack.length) to walk the range.

Examples

// count elements in range
int[] a = [ 1, 2, 4, 3, 2, 5, 3, 2, 4 ];
assert(count(a) == 9);
// count predicate in range
assert(count!("a > 2")(a) == 5);
@parampred Optional predicate to find elements.@paramhaystack The range to count.@returnsThe number of elements in haystack (for which pred returned true).
count
!(m => m > 32));
} void
void font_libraries_raster_oracle_diff.measure(void* library, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, string path)
measure
(void*
(parameter) void* library
library
,
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_t
hb_draw_funcs_t
*
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
,
(alias) object.string = string
string
(parameter) string path
path
)
{ auto
(local variable) font_libraries_raster_oracle_diff.hb_blob_t* blob
blob
=
font_libraries_raster_oracle_diff.hb_blob_t* font_libraries_raster_oracle_diff.hb_blob_create_from_file(const(char)*) nothrow @nogc
hb_blob_create_from_file
(
(parameter) string path
path
.
immutable(char)* std.string.toStringz(scope const(char)[] s) pure nothrow @trusted

Examples

import core.stdc.string : strlen;
import std.conv : to;

auto p = toStringz("foo");
assert(strlen(p) == 3);
const(char)[] foo = "abbzxyzzy";
p = toStringz(foo[3 .. 5]);
assert(strlen(p) == 2);

string test = "";
p = toStringz(test);
assert(*p == 0);

test = "\0";
p = toStringz(test);
assert(*p == 0);

test = "foo\0";
p = toStringz(test);
assert(p[0] == 'f' && p[1] == 'o' && p[2] == 'o' && p[3] == 0);

const string test2 = "";
p = toStringz(test2);
assert(*p == 0);

assert(toStringz([]) is toStringz(""));
@params A D-style string.@returns

A C-style null-terminated string equivalent to s. s must not contain embedded '\0''s as any C function will treat the first '\0' that it sees as the end of the string. If ``s.empty is true, then a string containing only '\0' is returned.

Important Note: When passing a char* to a C function, and the C function keeps it around for any reason, make sure that you keep a reference to it in your D code. Otherwise, it may become invalid during a garbage collection cycle and cause a nasty bug when the C code tries to use it.

toStringz
);
scope (exit)
void font_libraries_raster_oracle_diff.hb_blob_destroy(font_libraries_raster_oracle_diff.hb_blob_t*) nothrow @nogc
hb_blob_destroy
(
(local variable) font_libraries_raster_oracle_diff.hb_blob_t* blob
blob
);
if (
uint font_libraries_raster_oracle_diff.hb_blob_get_length(font_libraries_raster_oracle_diff.hb_blob_t*) nothrow @nogc
hb_blob_get_length
(
(local variable) font_libraries_raster_oracle_diff.hb_blob_t* blob
blob
) == 0)
{
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("SKIP: empty blob for ",
(parameter) string path
path
);
return; } auto
(local variable) font_libraries_raster_oracle_diff.hb_face_t* face
face
=
font_libraries_raster_oracle_diff.hb_face_t* font_libraries_raster_oracle_diff.hb_face_create(font_libraries_raster_oracle_diff.hb_blob_t*, uint) nothrow @nogc
hb_face_create
(
(local variable) font_libraries_raster_oracle_diff.hb_blob_t* blob
blob
, 0);
scope (exit)
void font_libraries_raster_oracle_diff.hb_face_destroy(font_libraries_raster_oracle_diff.hb_face_t*) nothrow @nogc
hb_face_destroy
(
(local variable) font_libraries_raster_oracle_diff.hb_face_t* face
face
);
auto
(local variable) font_libraries_raster_oracle_diff.hb_font_t* font
font
=
font_libraries_raster_oracle_diff.hb_font_t* font_libraries_raster_oracle_diff.hb_font_create(font_libraries_raster_oracle_diff.hb_face_t*) nothrow @nogc
hb_font_create
(
(local variable) font_libraries_raster_oracle_diff.hb_face_t* face
face
);
scope (exit)
void font_libraries_raster_oracle_diff.hb_font_destroy(font_libraries_raster_oracle_diff.hb_font_t*) nothrow @nogc
hb_font_destroy
(
(local variable) font_libraries_raster_oracle_diff.hb_font_t* font
font
);
(struct) font_libraries_raster_oracle_diff.FT_FaceRec
FT_FaceRec
*
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
;
if (
int font_libraries_raster_oracle_diff.FT_New_Face(void* library, const(char)* path, long index, font_libraries_raster_oracle_diff.FT_FaceRec** face) nothrow @nogc
FT_New_Face
(
(parameter) void* library
library
,
(parameter) string path
path
.
immutable(char)* std.string.toStringz(scope const(char)[] s) pure nothrow @trusted

Examples

import core.stdc.string : strlen;
import std.conv : to;

auto p = toStringz("foo");
assert(strlen(p) == 3);
const(char)[] foo = "abbzxyzzy";
p = toStringz(foo[3 .. 5]);
assert(strlen(p) == 2);

string test = "";
p = toStringz(test);
assert(*p == 0);

test = "\0";
p = toStringz(test);
assert(*p == 0);

test = "foo\0";
p = toStringz(test);
assert(p[0] == 'f' && p[1] == 'o' && p[2] == 'o' && p[3] == 0);

const string test2 = "";
p = toStringz(test2);
assert(*p == 0);

assert(toStringz([]) is toStringz(""));
@params A D-style string.@returns

A C-style null-terminated string equivalent to s. s must not contain embedded '\0''s as any C function will treat the first '\0' that it sees as the end of the string. If ``s.empty is true, then a string containing only '\0' is returned.

Important Note: When passing a char* to a C function, and the C function keeps it around for any reason, make sure that you keep a reference to it in your D code. Otherwise, it may become invalid during a garbage collection cycle and cause a nasty bug when the C code tries to use it.

toStringz
, 0, &
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
) != 0)
{
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("SKIP: FreeType cannot open ",
(parameter) string path
path
);
return; } scope (exit)
int font_libraries_raster_oracle_diff.FT_Done_Face(font_libraries_raster_oracle_diff.FT_FaceRec* face) nothrow @nogc
FT_Done_Face
(
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
);
const
(local variable) const(uint) glyphs
glyphs
=
uint font_libraries_raster_oracle_diff.hb_face_get_glyph_count(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogc
hb_face_get_glyph_count
(
(local variable) font_libraries_raster_oracle_diff.hb_face_t* face
face
);
// The declared FreeType layout must agree with HarfBuzz before any pixel counts. if (
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
.
(field) ushort font_libraries_raster_oracle_diff.FT_FaceRec.units_per_EM
units_per_EM
!=
uint font_libraries_raster_oracle_diff.hb_face_get_upem(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogc
hb_face_get_upem
(
(local variable) font_libraries_raster_oracle_diff.hb_face_t* face
face
) ||
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
.
(field) long font_libraries_raster_oracle_diff.FT_FaceRec.num_glyphs
num_glyphs
!=
(local variable) const(uint) glyphs
glyphs
||
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
.
(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyph
glyph
.
(field) font_libraries_raster_oracle_diff.FT_FaceRec* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.face
face
!=
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
)
{
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("FAIL: FT_FaceRec layout disagrees with HarfBuzz for ",
(parameter) string path
path
);
return; } const
(local variable) const(bool[]) overlap
overlap
=
bool[] font_libraries_raster_oracle_diff.overlapFlags(const(ubyte)[] d) pure @safe

Per glyph, whether glyf sets OVERLAP_SIMPLE or OVERLAP_COMPOUND. Empty for a face without glyf (CFF), which has no such flag.

overlapFlags
(cast(const(ubyte)[])
void[] std.file.read!string(string name, ulong upTo = 18446744073709551615LU) @safe

Read entire contents of file name and returns it as an untyped array. If the file size is larger than upTo, only upTo bytes are read.

Examples

import std.utf : byChar;
scope(exit)
{
    assert(exists(deleteme));
    remove(deleteme);
}

std.file.write(deleteme, "1234"); // deleteme is the name of a temporary file
assert(read(deleteme, 2) == "12");
assert(read(deleteme.byChar) == "1234");
assert((cast(const(ubyte)[])read(deleteme)).length == 4);
@paramname string or range of characters representing the file name@paramupTo if present, the maximum number of bytes to read@returnsUntyped array of bytes read.@throwsFileException on error.@seereadText for reading and validating a text file.
read
(
(parameter) string path
path
));
void std.stdio.writefln!(char, string, const(uint), ushort, ulong)(in char[] fmt, string __param_1, const(uint) __param_2, ushort __param_3, ulong __param_4) @safe

Equivalent to writef(fmt, args, '\n').

writefln
("%s: %d glyphs, upem %d, %d flagged overlapping",
(parameter) string path
path
.
string std.path.baseName!(immutable(char))(return scope string path) pure nothrow @nogc @safe

Note

This function only strips away the specified suffix, which doesn't necessarily have to represent an extension. To remove the extension from a path, regardless of what the extension is, use stripExtension. To obtain the filename without leading directories and without an extension, combine the functions like this:

assert(baseName(stripExtension("dir/file.ext")) == "file");
@paramcs Whether or not suffix matching is case-sensitive.@parampath A path name. It can be a string, or any random-access range of characters.@paramsuffix An optional suffix to be removed from the file name.@returns

The name of the file in the path name, without any leading directory and with an optional suffix chopped off.

If suffix is specified, it will be compared to path using filenameCmp!cs, where cs is an optional template parameter determining whether the comparison is case sensitive or not. See the filenameCmp documentation for details.

@standardsThis function complies with the POSIX requirements for the 'basename' shell utility (with suitable adaptations for Windows paths).
baseName
,
(local variable) const(uint) glyphs
glyphs
,
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
.
(field) ushort font_libraries_raster_oracle_diff.FT_FaceRec.units_per_EM
units_per_EM
,
(local variable) const(bool[]) overlap
overlap
.
ulong std.algorithm.searching.count!("a == b", const(bool)[], bool)(const(bool)[] haystack, bool needle) pure nothrow @nogc @safe

Counts matches of needle in haystack.

The first overload counts each element e in haystack for which pred(e, needle) is true. pred defaults to equality. Performs O(haystack.length) evaluations of pred.

The second overload counts the number of times needle was matched in haystack. pred compares elements in each range. Throws an exception if needle`.empty` is `true`, as the count of the empty range in any range would be infinite. Overlapped counts are *not* considered, for example count("aaa", "aa") is 1, not 2.

Note

Regardless of the overload, count will not accept infinite ranges for haystack.

Examples

// count elements in range
int[] a = [ 1, 2, 4, 3, 2, 5, 3, 2, 4 ];
assert(count(a, 2) == 3);
assert(count!("a > b")(a, 2) == 5);
import std.uni : toLower;
// count range in range
assert(count("abcadfabf", "ab") == 2);
assert(count("ababab", "abab") == 1);
assert(count("ababab", "abx") == 0);
// fuzzy count range in range
assert(count!((a, b) => toLower(a) == toLower(b))("AbcAdFaBf", "ab") == 2);
@parampred The predicate to compare elements.@paramhaystack The range to count.@paramneedle The element or sub-range to count in haystack.@returnsThe number of matches in haystack.
count
(true));
foreach (
(parameter) font_libraries_raster_oracle_diff.Mode mode
mode
; [
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.production = 0

D, 0.02 px flattening, FreeType's overlap rule — vs FreeType

production
,
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.ftFlatten = 1

D with FreeType's flattening rules — vs FreeType

ftFlatten
,
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.fineReference = 2

D at 0.02 px — vs D at 0.001 px: the flattening error alone

fineReference
,
(enum) font_libraries_raster_oracle_diff.Mode

What a row compares, and against what.

Mode
.
(enum value) font_libraries_raster_oracle_diff.Mode.unflagged = 3

D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag

unflagged
])
foreach (
(parameter) int ppem
ppem
; [12, 16, 24, 48])
void font_libraries_raster_oracle_diff.compare(font_libraries_raster_oracle_diff.FT_FaceRec* ft, font_libraries_raster_oracle_diff.hb_font_t* font, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, const(bool)[] overlap, uint glyphs, int ppem, font_libraries_raster_oracle_diff.Mode mode)

One face at one size in one mode: per-pixel differences over pixels either side inks, and each glyph's largest difference.

compare
(
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ft
ft
,
(local variable) font_libraries_raster_oracle_diff.hb_font_t* font
font
,
(parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
,
(local variable) const(bool[]) overlap
overlap
,
(local variable) const(uint) glyphs
glyphs
,
(local variable) int ppem
ppem
,
(local variable) font_libraries_raster_oracle_diff.Mode mode
mode
);
}
(alias) object.string = string
string
[]
string[] font_libraries_raster_oracle_diff.resolveFonts(string[] args)
resolveFonts
(
(alias) object.string = string
string
[]
(parameter) string[] args
args
)
{
(alias) object.string = string
string
[]
(local variable) string[] given
given
;
foreach (
(parameter) string a
a
;
(parameter) string[] args
args
[1 .. $])
if (
bool std.file.exists!string(string name) nothrow @nogc @safe

Determine whether the given file (or directory) exists.

@paramname string or range of characters representing the file name@returnstrue if the file name specified as input exists
exists
(
(local variable) string a
a
))
(local variable) string[] given
given
~=
(local variable) string a
a
;
if (
(local variable) string[] given
given
.
(field) ulong string[].length
length
)
return
(local variable) string[] given
given
;
try { auto
(local variable) std.typecons.Tuple!(int, "status", string, "output") r
r
=
std.typecons.Tuple!(int, "status", string, "output") std.process.execute(scope const(char[])[] args, const(string[string]) env = cast(const(string[string]))null, std.process.Config config = Config(Flags.none, null, null), ulong maxOutput = 18446744073709551615LU, scope const(char)[] workDir = null) @safe

Executes the given program or shell command and returns its exit code and output.

execute and executeShell start a new process using spawnProcess and spawnShell, respectively, and wait for the process to complete before returning. The functions capture what the child process prints to both its standard output and standard error streams, and return this together with its exit code.

auto dmd = execute(["dmd", "myapp.d"]);
if (dmd.status != 0) writeln("Compilation failed:\n", dmd.output);

auto ls = executeShell("ls -l");
if (ls.status != 0) writeln("Failed to retrieve file listing");
else writeln(ls.output);

The args/program/command, env and config parameters are forwarded straight to the underlying spawn functions, and we refer to their documentation for details.

POSIX specific

If the process is terminated by a signal, the status field of the return value will contain a negative number whose absolute value is the signal number. (See wait for details.)

@paramargs An array which contains the program name as the zeroth element and any command-line arguments in the following elements. (See spawnProcess for details.)@paramprogram The program name, without command-line arguments. (See spawnProcess for details.)@paramcommand A shell command which is passed verbatim to the command interpreter. (See spawnShell for details.)@paramenv Additional environment variables for the child process. (See spawnProcess for details.)@paramconfig Flags that control process creation. See Config for an overview of available flags, and note that the retainStd... flags have no effect in this function.@parammaxOutput The maximum number of bytes of output that should be captured.@paramworkDir The working directory for the new process. By default the child process inherits the parent's working directory.@paramshellPath The path to the shell to use to run the specified program. By default this is nativeShell.@returnsAn std.typecons.Tuple!(int, "status", string, "output").@throws

ProcessException on failure to start the process.

StdioException on failure to capture output.

execute
(["fc-match", "-f", "%{file}", "monospace"]);
if (
(local variable) std.typecons.Tuple!(int, "status", string, "output") r
r
.status == 0 &&
(field) int std.typecons.Tuple!(int, "status", string, "output").__expand_field_0
r
.output.
string std.string.strip!string(string str) pure nothrow @nogc @safe

Strips both leading and trailing whitespace (as defined by isWhite) or as specified in the second argument.

Examples

import std.uni : lineSep, paraSep;
assert(strip("     hello world     ") ==
       "hello world");
assert(strip("\n\t\v\rhello world\n\t\v\r") ==
       "hello world");
assert(strip("hello world") ==
       "hello world");
assert(strip([lineSep] ~ "hello world" ~ [lineSep]) ==
       "hello world");
assert(strip([paraSep] ~ "hello world" ~ [paraSep]) ==
       "hello world");
@paramstr string or random access range of characters@paramchars string of characters to be stripped@paramleftChars string of leading characters to be stripped@paramrightChars string of trailing characters to be stripped@returnsslice of str stripped of leading and trailing whitespace or characters as specified in the second argument.@seeGeneric stripping on ranges: strip
strip
.
(field) string std.typecons.Tuple!(int, "status", string, "output").__expand_field_1
length
&&
bool std.file.exists!string(string name) nothrow @nogc @safe

Determine whether the given file (or directory) exists.

@paramname string or range of characters representing the file name@returnstrue if the file name specified as input exists
exists
(
(local variable) std.typecons.Tuple!(int, "status", string, "output") r
r
.output.
string std.string.strip!string(string str) pure nothrow @nogc @safe

Strips both leading and trailing whitespace (as defined by isWhite) or as specified in the second argument.

Examples

import std.uni : lineSep, paraSep;
assert(strip("     hello world     ") ==
       "hello world");
assert(strip("\n\t\v\rhello world\n\t\v\r") ==
       "hello world");
assert(strip("hello world") ==
       "hello world");
assert(strip([lineSep] ~ "hello world" ~ [lineSep]) ==
       "hello world");
assert(strip([paraSep] ~ "hello world" ~ [paraSep]) ==
       "hello world");
@paramstr string or random access range of characters@paramchars string of characters to be stripped@paramleftChars string of leading characters to be stripped@paramrightChars string of trailing characters to be stripped@returnsslice of str stripped of leading and trailing whitespace or characters as specified in the second argument.@seeGeneric stripping on ranges: strip
strip
))
return [
(local variable) std.typecons.Tuple!(int, "status", string, "output") r
r
.output.
string std.string.strip!string(string str) pure nothrow @nogc @safe

Strips both leading and trailing whitespace (as defined by isWhite) or as specified in the second argument.

Examples

import std.uni : lineSep, paraSep;
assert(strip("     hello world     ") ==
       "hello world");
assert(strip("\n\t\v\rhello world\n\t\v\r") ==
       "hello world");
assert(strip("hello world") ==
       "hello world");
assert(strip([lineSep] ~ "hello world" ~ [lineSep]) ==
       "hello world");
assert(strip([paraSep] ~ "hello world" ~ [paraSep]) ==
       "hello world");
@paramstr string or random access range of characters@paramchars string of characters to be stripped@paramleftChars string of leading characters to be stripped@paramrightChars string of trailing characters to be stripped@returnsslice of str stripped of leading and trailing whitespace or characters as specified in the second argument.@seeGeneric stripping on ranges: strip
strip
];
} catch (
(class) object.Exception

The base class of all errors that are safe to catch and handle.

In principle, only thrown objects derived from this class are safe to catch inside a catch block. Thrown objects not derived from Exception represent runtime errors that should not be caught, as certain runtime guarantees may not hold, making it unsafe to continue program execution.

Examples

bool gotCaught;
try
{
    throw new Exception("msg");
}
catch (Exception e)
{
    gotCaught = true;
    assert(e.msg == "msg");
}
assert(gotCaught);
Exception
) {}
return null; } int
int D main(string[] args)
main
(
(alias) object.string = string
string
[]
(parameter) string[] args
args
)
{ const
(local variable) const(string[]) fonts
fonts
=
string[] font_libraries_raster_oracle_diff.resolveFonts(string[] args)
resolveFonts
(
(parameter) string[] args
args
);
if (!
(local variable) const(string[]) fonts
fonts
.
(field) ulong const(string[]).length
length
)
{
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("SKIP: no font file resolved (pass paths, or install fontconfig)");
return 0; } void*
(local variable) void* library
library
;
if (
int font_libraries_raster_oracle_diff.FT_Init_FreeType(void** library) nothrow @nogc
FT_Init_FreeType
(&
(local variable) void* library
library
) != 0)
{
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("SKIP: FreeType failed to initialize");
return 0; } scope (exit)
int font_libraries_raster_oracle_diff.FT_Done_FreeType(void* library) nothrow @nogc
FT_Done_FreeType
(
(local variable) void* library
library
);
auto
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
=
font_libraries_raster_oracle_diff.hb_draw_funcs_t* font_libraries_raster_oracle_diff.hb_draw_funcs_create() nothrow @nogc
hb_draw_funcs_create
();
scope (exit)
void font_libraries_raster_oracle_diff.hb_draw_funcs_destroy(font_libraries_raster_oracle_diff.hb_draw_funcs_t*) nothrow @nogc
hb_draw_funcs_destroy
(
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
);
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_move_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_move_to_func
(
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, &
void font_libraries_raster_oracle_diff.onMove(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float x, float y, void* __param_5) nothrow @nogc
onMove
, null, null);
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_line_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_line_to_func
(
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, &
void font_libraries_raster_oracle_diff.onLine(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float x, float y, void* __param_5) nothrow @nogc
onLine
, null, null);
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_quadratic_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_quadratic_to_func
(
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, &
void font_libraries_raster_oracle_diff.onQuad(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float cx, float cy, float x, float y, void* __param_7) nothrow @nogc
onQuad
, null, null);
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_cubic_to_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, float, float, float, float, float, float, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_cubic_to_func
(
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, &
void font_libraries_raster_oracle_diff.onCubic(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, float c1x, float c1y, float c2x, float c2y, float x, float y, void* __param_9) nothrow @nogc
onCubic
, null, null);
void font_libraries_raster_oracle_diff.hb_draw_funcs_set_close_path_func(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, extern (C) void function(font_libraries_raster_oracle_diff.hb_draw_funcs_t*, void*, font_libraries_raster_oracle_diff.hb_draw_state_t*, void*) nothrow @nogc, void*, void*) nothrow @nogc
hb_draw_funcs_set_close_path_func
(
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
, &
void font_libraries_raster_oracle_diff.onClose(font_libraries_raster_oracle_diff.hb_draw_funcs_t* __param_0, void* d, font_libraries_raster_oracle_diff.hb_draw_state_t* __param_2, void* __param_3) nothrow @nogc
onClose
, null, null);
foreach (
(parameter) const(string) path
path
;
(local variable) const(string[]) fonts
fonts
)
void font_libraries_raster_oracle_diff.measure(void* library, font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs, string path)
measure
(
(local variable) void* library
library
,
(local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcs
funcs
,
(local variable) const(string) path
path
);
return 0; }