#!/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_diffHow 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) corecore.(package) core.stdcstdc.(module) core.stdc.configD compatible types that correspond to various basic types in associated
C and C++ compilers.
Source
core/stdc/config.d
config : c_long;
import (package) stdstd.(module) std.algorithmThis 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
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.
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.
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.
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.
sort;
import (package) stdstd.(module) std.fileUtilities 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
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.
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.
read;
import (package) stdstd.(module) std.mathContains 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
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.
abs, (alias) font_libraries_raster_oracle_diff.ceil = real std.math.rounding.ceil(real x) pure nothrow @nogc @trustedReturns 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 @trustedReturns 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 @safeCompute square root of x.
x sqrt(x) invalid? -0.0 -0.0 no <0.0 yes + + no
sqrt;
import (package) stdstd.(module) std.pathThis 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
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");
baseName;
import (package) stdstd.(module) std.processFunctions 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.
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) @safeExecutes 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.)
execute;
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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);
}
}
writeln;
import (package) stdstd.(module) std.stringString 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
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.
strip, (alias) font_libraries_raster_oracle_diff.toStringz = immutable(char)* std.string.toStringz(scope const(char)[] s) pure nothrow @trustedtoStringz;
// ---------------------------------------------------------------------------
// HarfBuzz and FreeType C ABIs, the subsets this program needs.
// ---------------------------------------------------------------------------
extern (C) nothrow @nogc
{
struct (struct) font_libraries_raster_oracle_diff.hb_blob_thb_blob_t;
struct (struct) font_libraries_raster_oracle_diff.hb_face_thb_face_t;
struct (struct) font_libraries_raster_oracle_diff.hb_font_thb_font_t;
struct (struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t;
struct (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_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 @nogcMoveToFn = void function((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void*, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_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 @nogcQuadToFn = void function((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void*, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_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 @nogcCubicToFn = void function((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void*, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_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 @nogcCloseFn = void function((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void*, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_draw_state_t*, void*);
(struct) font_libraries_raster_oracle_diff.hb_blob_thb_blob_t* font_libraries_raster_oracle_diff.hb_blob_t* font_libraries_raster_oracle_diff.hb_blob_create_from_file(const(char)*) nothrow @nogchb_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 @nogchb_blob_destroy((struct) font_libraries_raster_oracle_diff.hb_blob_thb_blob_t*);
uint uint font_libraries_raster_oracle_diff.hb_blob_get_length(font_libraries_raster_oracle_diff.hb_blob_t*) nothrow @nogchb_blob_get_length((struct) font_libraries_raster_oracle_diff.hb_blob_thb_blob_t*);
(struct) font_libraries_raster_oracle_diff.hb_face_thb_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 @nogchb_face_create((struct) font_libraries_raster_oracle_diff.hb_blob_thb_blob_t*, uint);
void void font_libraries_raster_oracle_diff.hb_face_destroy(font_libraries_raster_oracle_diff.hb_face_t*) nothrow @nogchb_face_destroy((struct) font_libraries_raster_oracle_diff.hb_face_thb_face_t*);
uint uint font_libraries_raster_oracle_diff.hb_face_get_upem(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogchb_face_get_upem(const((struct) font_libraries_raster_oracle_diff.hb_face_thb_face_t)*);
uint uint font_libraries_raster_oracle_diff.hb_face_get_glyph_count(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogchb_face_get_glyph_count(const((struct) font_libraries_raster_oracle_diff.hb_face_thb_face_t)*);
(struct) font_libraries_raster_oracle_diff.hb_font_thb_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 @nogchb_font_create((struct) font_libraries_raster_oracle_diff.hb_face_thb_face_t*);
void void font_libraries_raster_oracle_diff.hb_font_destroy(font_libraries_raster_oracle_diff.hb_font_t*) nothrow @nogchb_font_destroy((struct) font_libraries_raster_oracle_diff.hb_font_thb_font_t*);
void void font_libraries_raster_oracle_diff.hb_font_set_scale(font_libraries_raster_oracle_diff.hb_font_t*, int, int) nothrow @nogchb_font_set_scale((struct) font_libraries_raster_oracle_diff.hb_font_thb_font_t*, int, int);
(struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t* font_libraries_raster_oracle_diff.hb_draw_funcs_t* font_libraries_raster_oracle_diff.hb_draw_funcs_create() nothrow @nogchb_draw_funcs_create();
void void font_libraries_raster_oracle_diff.hb_draw_funcs_destroy(font_libraries_raster_oracle_diff.hb_draw_funcs_t*) nothrow @nogchb_draw_funcs_destroy((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_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 @nogchb_draw_funcs_set_move_to_func((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_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 @nogcMoveToFn, 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 @nogchb_draw_funcs_set_line_to_func((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_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 @nogcMoveToFn, 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 @nogchb_draw_funcs_set_quadratic_to_func((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_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 @nogcQuadToFn, 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 @nogchb_draw_funcs_set_cubic_to_func((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_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 @nogcCubicToFn, 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 @nogchb_draw_funcs_set_close_path_func((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_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 @nogcCloseFn, 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 @nogchb_font_draw_glyph((struct) font_libraries_raster_oracle_diff.hb_font_thb_font_t*, uint, (struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void*);
// freetype.h and ftimage.h. Leading fields only: D never allocates these.
struct (struct) font_libraries_raster_oracle_diff.FT_GenericFT_Generic { void* (field) void* font_libraries_raster_oracle_diff.FT_Generic.datadata; void* (field) void* font_libraries_raster_oracle_diff.FT_Generic.finalizerfinalizer; }
struct (struct) font_libraries_raster_oracle_diff.FT_BBoxFT_BBox { c_long (field) long font_libraries_raster_oracle_diff.FT_BBox.xMinxMin, (field) long font_libraries_raster_oracle_diff.FT_BBox.yMinyMin, (field) long font_libraries_raster_oracle_diff.FT_BBox.xMaxxMax, (field) long font_libraries_raster_oracle_diff.FT_BBox.yMaxyMax; }
struct (struct) font_libraries_raster_oracle_diff.FT_VectorFT_Vector { c_long (field) long font_libraries_raster_oracle_diff.FT_Vector.xx, (field) long font_libraries_raster_oracle_diff.FT_Vector.yy; }
struct (struct) font_libraries_raster_oracle_diff.FT_Glyph_MetricsFT_Glyph_Metrics
{
c_long (field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.widthwidth, (field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.heightheight, (field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.horiBearingXhoriBearingX, (field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.horiBearingYhoriBearingY, (field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.horiAdvancehoriAdvance,
(field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.vertBearingXvertBearingX, (field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.vertBearingYvertBearingY, (field) long font_libraries_raster_oracle_diff.FT_Glyph_Metrics.vertAdvancevertAdvance;
}
struct (struct) font_libraries_raster_oracle_diff.FT_BitmapFT_Bitmap
{
uint (field) uint font_libraries_raster_oracle_diff.FT_Bitmap.rowsrows, (field) uint font_libraries_raster_oracle_diff.FT_Bitmap.widthwidth;
int (field) int font_libraries_raster_oracle_diff.FT_Bitmap.pitchpitch;
ubyte* (field) ubyte* font_libraries_raster_oracle_diff.FT_Bitmap.bufferbuffer;
ushort (field) ushort font_libraries_raster_oracle_diff.FT_Bitmap.num_graysnum_grays;
ubyte (field) ubyte font_libraries_raster_oracle_diff.FT_Bitmap.pixel_modepixel_mode, (field) ubyte font_libraries_raster_oracle_diff.FT_Bitmap.palette_modepalette_mode;
void* (field) void* font_libraries_raster_oracle_diff.FT_Bitmap.palettepalette;
}
struct (struct) font_libraries_raster_oracle_diff.FT_GlyphSlotRecFT_GlyphSlotRec
{
void* (field) void* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.librarylibrary;
(struct) font_libraries_raster_oracle_diff.FT_FaceRecFT_FaceRec* (field) font_libraries_raster_oracle_diff.FT_FaceRec* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.faceface;
(struct) font_libraries_raster_oracle_diff.FT_GlyphSlotRecFT_GlyphSlotRec* (field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.nextnext;
uint (field) uint font_libraries_raster_oracle_diff.FT_GlyphSlotRec.glyph_indexglyph_index;
(struct) font_libraries_raster_oracle_diff.FT_GenericFT_Generic (field) font_libraries_raster_oracle_diff.FT_Generic font_libraries_raster_oracle_diff.FT_GlyphSlotRec.genericgeneric;
(struct) font_libraries_raster_oracle_diff.FT_Glyph_MetricsFT_Glyph_Metrics (field) font_libraries_raster_oracle_diff.FT_Glyph_Metrics font_libraries_raster_oracle_diff.FT_GlyphSlotRec.metricsmetrics;
c_long (field) long font_libraries_raster_oracle_diff.FT_GlyphSlotRec.linearHoriAdvancelinearHoriAdvance, (field) long font_libraries_raster_oracle_diff.FT_GlyphSlotRec.linearVertAdvancelinearVertAdvance;
(struct) font_libraries_raster_oracle_diff.FT_VectorFT_Vector (field) font_libraries_raster_oracle_diff.FT_Vector font_libraries_raster_oracle_diff.FT_GlyphSlotRec.advanceadvance;
uint (field) uint font_libraries_raster_oracle_diff.FT_GlyphSlotRec.formatformat;
(struct) font_libraries_raster_oracle_diff.FT_BitmapFT_Bitmap (field) font_libraries_raster_oracle_diff.FT_Bitmap font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmapbitmap;
int (field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_leftbitmap_left, (field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_topbitmap_top;
}
struct (struct) font_libraries_raster_oracle_diff.FT_FaceRecFT_FaceRec
{
c_long (field) long font_libraries_raster_oracle_diff.FT_FaceRec.num_facesnum_faces, (field) long font_libraries_raster_oracle_diff.FT_FaceRec.face_indexface_index, (field) long font_libraries_raster_oracle_diff.FT_FaceRec.face_flagsface_flags, (field) long font_libraries_raster_oracle_diff.FT_FaceRec.style_flagsstyle_flags, (field) long font_libraries_raster_oracle_diff.FT_FaceRec.num_glyphsnum_glyphs;
char* (field) char* font_libraries_raster_oracle_diff.FT_FaceRec.family_namefamily_name, (field) char* font_libraries_raster_oracle_diff.FT_FaceRec.style_namestyle_name;
int (field) int font_libraries_raster_oracle_diff.FT_FaceRec.num_fixed_sizesnum_fixed_sizes;
void* (field) void* font_libraries_raster_oracle_diff.FT_FaceRec.available_sizesavailable_sizes;
int (field) int font_libraries_raster_oracle_diff.FT_FaceRec.num_charmapsnum_charmaps;
void* (field) void* font_libraries_raster_oracle_diff.FT_FaceRec.charmapscharmaps;
(struct) font_libraries_raster_oracle_diff.FT_GenericFT_Generic (field) font_libraries_raster_oracle_diff.FT_Generic font_libraries_raster_oracle_diff.FT_FaceRec.genericgeneric;
(struct) font_libraries_raster_oracle_diff.FT_BBoxFT_BBox (field) font_libraries_raster_oracle_diff.FT_BBox font_libraries_raster_oracle_diff.FT_FaceRec.bboxbbox;
ushort (field) ushort font_libraries_raster_oracle_diff.FT_FaceRec.units_per_EMunits_per_EM;
short (field) short font_libraries_raster_oracle_diff.FT_FaceRec.ascenderascender, (field) short font_libraries_raster_oracle_diff.FT_FaceRec.descenderdescender, (field) short font_libraries_raster_oracle_diff.FT_FaceRec.heightheight, (field) short font_libraries_raster_oracle_diff.FT_FaceRec.max_advance_widthmax_advance_width, (field) short font_libraries_raster_oracle_diff.FT_FaceRec.max_advance_heightmax_advance_height,
(field) short font_libraries_raster_oracle_diff.FT_FaceRec.underline_positionunderline_position, (field) short font_libraries_raster_oracle_diff.FT_FaceRec.underline_thicknessunderline_thickness;
(struct) font_libraries_raster_oracle_diff.FT_GlyphSlotRecFT_GlyphSlotRec* (field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyphglyph;
}
int int font_libraries_raster_oracle_diff.FT_Init_FreeType(void** library) nothrow @nogcFT_Init_FreeType(void** (parameter) void** librarylibrary);
int int font_libraries_raster_oracle_diff.FT_Done_FreeType(void* library) nothrow @nogcFT_Done_FreeType(void* (parameter) void* librarylibrary);
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 @nogcFT_New_Face(void* (parameter) void* librarylibrary, const(char)* (parameter) const(char)* pathpath, c_long (parameter) long indexindex, (struct) font_libraries_raster_oracle_diff.FT_FaceRecFT_FaceRec** (parameter) font_libraries_raster_oracle_diff.FT_FaceRec** faceface);
int int font_libraries_raster_oracle_diff.FT_Done_Face(font_libraries_raster_oracle_diff.FT_FaceRec* face) nothrow @nogcFT_Done_Face((struct) font_libraries_raster_oracle_diff.FT_FaceRecFT_FaceRec* (parameter) font_libraries_raster_oracle_diff.FT_FaceRec* faceface);
int int font_libraries_raster_oracle_diff.FT_Set_Pixel_Sizes(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint width, uint height) nothrow @nogcFT_Set_Pixel_Sizes((struct) font_libraries_raster_oracle_diff.FT_FaceRecFT_FaceRec* (parameter) font_libraries_raster_oracle_diff.FT_FaceRec* faceface, uint (parameter) uint widthwidth, uint (parameter) uint heightheight);
int int font_libraries_raster_oracle_diff.FT_Load_Glyph(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint glyph, int flags) nothrow @nogcFT_Load_Glyph((struct) font_libraries_raster_oracle_diff.FT_FaceRecFT_FaceRec* (parameter) font_libraries_raster_oracle_diff.FT_FaceRec* faceface, uint (parameter) uint glyphglyph, int (parameter) int flagsflags);
}
enum (constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_HINTING = 2FT_LOAD_NO_HINTING = 1 << 1, (constant) int font_libraries_raster_oracle_diff.FT_LOAD_RENDER = 4FT_LOAD_RENDER = 1 << 2, (constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_BITMAP = 8FT_LOAD_NO_BITMAP = 1 << 3;
enum (constant) int font_libraries_raster_oracle_diff.FT_PIXEL_MODE_GRAY = 2FT_PIXEL_MODE_GRAY = 2;
// ---------------------------------------------------------------------------
// The rasterizer of outline-sink-raster.d, emitting 8-bit coverage.
// ---------------------------------------------------------------------------
struct (struct) font_libraries_raster_oracle_diff.RasterizerRasterizer
{
int (field) int font_libraries_raster_oracle_diff.Rasterizer.ww, (field) int font_libraries_raster_oracle_diff.Rasterizer.hh;
float[] (field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc;
this(int (parameter) int ww, int (parameter) int hh) { this.(field) int font_libraries_raster_oracle_diff.Rasterizer.ww = (parameter) int ww; this.(field) int font_libraries_raster_oracle_diff.Rasterizer.hh = (parameter) int hh; (field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc = new float[((parameter) int ww + 2) * (parameter) int hh]; (field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[] = 0; }
void void font_libraries_raster_oracle_diff.Rasterizer.line(float x0, float y0, float x1, float y1) pure nothrow @nogc @safeline(float (parameter) float x0x0, float (parameter) float y0y0, float (parameter) float x1x1, float (parameter) float y1y1) @safe pure nothrow @nogc
{
if ((parameter) float y0y0 == (parameter) float y1y1) return;
float (local variable) float dirdir = 1;
if ((parameter) float y0y0 > (parameter) float y1y1) { (local variable) float dirdir = -1; void font_libraries_raster_oracle_diff.swap(ref float a, ref float b) pure nothrow @nogc @safeswap((parameter) float x0x0, (parameter) float x1x1); void font_libraries_raster_oracle_diff.swap(ref float a, ref float b) pure nothrow @nogc @safeswap((parameter) float y0y0, (parameter) float y1y1); }
const (local variable) const(float) dxdydxdy = ((parameter) float x1x1 - (parameter) float x0x0) / ((parameter) float y1y1 - (parameter) float y0y0);
float (local variable) float xx = (parameter) float x0x0;
if ((parameter) float y0y0 < 0) (local variable) float xx -= (parameter) float y0y0 * (local variable) const(float) dxdydxdy;
const (local variable) const(int) yEndyEnd = int std.algorithm.comparison.min!(int, int)(int a, int b) pure nothrow @nogc @safeIterates 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);
min((field) int font_libraries_raster_oracle_diff.Rasterizer.hh, cast(int) float std.math.rounding.ceil(float x) pure nothrow @nogc @trustedceil((parameter) float y1y1));
for (int (local variable) int yy = int std.algorithm.comparison.max!(int, int)(int a, int b) pure nothrow @nogc @safeIterates 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);
max(0, cast(int) (parameter) float y0y0); y < yEnd; ++y)
{
const (local variable) const(int) rowrow = (local variable) int yy * ((field) int font_libraries_raster_oracle_diff.Rasterizer.ww + 2);
const (local variable) const(float) dydy = float std.algorithm.comparison.min!(float, float)(float a, float b) pure nothrow @nogc @safeIterates 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);
min((local variable) int yy + 1.0f, (parameter) float y1y1) - float std.algorithm.comparison.max!(float, float)(float a, float b) pure nothrow @nogc @safeIterates 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);
max(cast(float) (local variable) int yy, (parameter) float y0y0);
const (local variable) const(float) xnextxnext = (local variable) float xx + (local variable) const(float) dxdydxdy * (local variable) const(float) dydy;
const (local variable) const(float) dd = (local variable) const(float) dydy * (local variable) float dirdir;
const (local variable) const(float) xaxa = float std.algorithm.comparison.min!(float, const(float))(float __param_0, const(float) __param_1) pure nothrow @nogc @safeIterates the passed arguments and returns the minimum value.
min((local variable) float xx, (local variable) const(float) xnextxnext), (local variable) const(float) xbxb = float std.algorithm.comparison.max!(float, const(float))(float __param_0, const(float) __param_1) pure nothrow @nogc @safeIterates the passed arguments and returns the maximum value.
max((local variable) float xx, (local variable) const(float) xnextxnext);
const (local variable) const(float) xaFloorxaFloor = float std.math.rounding.floor(float x) pure nothrow @nogc @trustedfloor((local variable) const(float) xaxa);
const (local variable) const(int) xaixai = cast(int) (local variable) const(float) xaFloorxaFloor;
const (local variable) const(float) xbCeilxbCeil = float std.math.rounding.ceil(float x) pure nothrow @nogc @trustedceil((local variable) const(float) xbxb);
const (local variable) const(int) xbixbi = cast(int) (local variable) const(float) xbCeilxbCeil;
if ((local variable) const(int) xaixai < 0 || (local variable) const(int) xbixbi > (field) int font_libraries_raster_oracle_diff.Rasterizer.ww + 1) { (local variable) float xx = (local variable) const(float) xnextxnext; continue; }
if ((local variable) const(int) xbixbi <= (local variable) const(int) xaixai + 1)
{
const (local variable) const(float) xmfxmf = 0.5f * ((local variable) float xx + (local variable) const(float) xnextxnext) - (local variable) const(float) xaFloorxaFloor;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) const(int) xaixai] += (local variable) const(float) dd - (local variable) const(float) dd * (local variable) const(float) xmfxmf;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) const(int) xaixai + 1] += (local variable) const(float) dd * (local variable) const(float) xmfxmf;
}
else
{
const (local variable) const(float) ss = 1.0f / ((local variable) const(float) xbxb - (local variable) const(float) xaxa);
const (local variable) const(float) xafxaf = (local variable) const(float) xaxa - (local variable) const(float) xaFloorxaFloor;
const (local variable) const(float) a0a0 = 0.5f * (local variable) const(float) ss * (1 - (local variable) const(float) xafxaf) * (1 - (local variable) const(float) xafxaf);
const (local variable) const(float) xbfxbf = (local variable) const(float) xbxb - (local variable) const(float) xbCeilxbCeil + 1;
const (local variable) const(float) amam = 0.5f * (local variable) const(float) ss * (local variable) const(float) xbfxbf * (local variable) const(float) xbfxbf;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) const(int) xaixai] += (local variable) const(float) dd * (local variable) const(float) a0a0;
if ((local variable) const(int) xbixbi == (local variable) const(int) xaixai + 2)
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) const(int) xaixai + 1] += (local variable) const(float) dd * (1 - (local variable) const(float) a0a0 - (local variable) const(float) amam);
else
{
const (local variable) const(float) a1a1 = (local variable) const(float) ss * (1.5f - (local variable) const(float) xafxaf);
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) const(int) xaixai + 1] += (local variable) const(float) dd * ((local variable) const(float) a1a1 - (local variable) const(float) a0a0);
foreach ((local variable) int xixi; (local variable) const(int) xaixai + 2 .. (local variable) const(int) xbixbi - 1)
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) int xixi] += (local variable) const(float) dd * (local variable) const(float) ss;
const (local variable) const(float) a2a2 = (local variable) const(float) a1a1 + ((local variable) const(int) xbixbi - (local variable) const(int) xaixai - 3) * (local variable) const(float) ss;
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) const(int) xbixbi - 1] += (local variable) const(float) dd * (1 - (local variable) const(float) a2a2 - (local variable) const(float) amam);
}
(field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) const(int) rowrow + (local variable) const(int) xbixbi] += (local variable) const(float) dd * (local variable) const(float) amam;
}
(local variable) float xx = (local variable) const(float) xnextxnext;
}
}
ubyte[] ubyte[] font_libraries_raster_oracle_diff.Rasterizer.coverage() const pure nothrow @safecoverage() const @safe pure nothrow
{
auto (local variable) ubyte[] cc = new ubyte[(field) int font_libraries_raster_oracle_diff.Rasterizer.ww * (field) int font_libraries_raster_oracle_diff.Rasterizer.hh];
foreach ((local variable) int yy; 0 .. (field) int font_libraries_raster_oracle_diff.Rasterizer.hh)
{
float (local variable) float sumsum = 0;
foreach ((local variable) int xx; 0 .. (field) int font_libraries_raster_oracle_diff.Rasterizer.ww)
{
(local variable) float sumsum += (field) float[] font_libraries_raster_oracle_diff.Rasterizer.accacc[(local variable) int yy * ((field) int font_libraries_raster_oracle_diff.Rasterizer.ww + 2) + (local variable) int xx];
(local variable) ubyte[] cc[(local variable) int yy * (field) int font_libraries_raster_oracle_diff.Rasterizer.ww + (local variable) int xx] = cast(ubyte)(float std.algorithm.comparison.min!(float, float)(float a, float b) pure nothrow @nogc @safeIterates 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);
min(float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safeCalculates 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);
abs((local variable) float sumsum), 1.0f) * 255 + 0.5f);
}
}
return (local variable) ubyte[] cc;
}
}
void void font_libraries_raster_oracle_diff.swap(ref float a, ref float b) pure nothrow @nogc @safeswap(ref float (parameter) float aa, ref float (parameter) float bb) @safe pure nothrow @nogc { const (local variable) const(float) tt = (parameter) float aa; (parameter) float aa = (parameter) float bb; (parameter) float bb = (local variable) const(float) tt; }
// ---------------------------------------------------------------------------
// 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.SinkSink
{
(struct) font_libraries_raster_oracle_diff.RasterizerRasterizer* (field) font_libraries_raster_oracle_diff.Rasterizer* font_libraries_raster_oracle_diff.Sink.rr;
float (field) float font_libraries_raster_oracle_diff.Sink.oxox, (field) float font_libraries_raster_oracle_diff.Sink.oyoy; // origin in raster pixels, y-down
float (field) float font_libraries_raster_oracle_diff.Sink.kk; // raster pixels per output pixel: 1, or 4 when supersampling
bool (field) bool font_libraries_raster_oracle_diff.Sink.freetypeFlatteningfreetypeFlattening;
float (field) float font_libraries_raster_oracle_diff.Sink.tolerancetolerance; // flattening tolerance in px, when not FreeType's rules
float (field) float font_libraries_raster_oracle_diff.Sink.pxpx, (field) float font_libraries_raster_oracle_diff.Sink.pypy, (field) float font_libraries_raster_oracle_diff.Sink.startXstartX, (field) float font_libraries_raster_oracle_diff.Sink.startYstartY;
bool (field) bool font_libraries_raster_oracle_diff.Sink.drewdrew;
float float font_libraries_raster_oracle_diff.Sink.sx(float x) const nothrow @nogcsx(float (parameter) float xx) const nothrow @nogc => (field) float font_libraries_raster_oracle_diff.Sink.oxox + (parameter) float xx / 64 * (field) float font_libraries_raster_oracle_diff.Sink.kk;
float float font_libraries_raster_oracle_diff.Sink.sy(float y) const nothrow @nogcsy(float (parameter) float yy) const nothrow @nogc => (field) float font_libraries_raster_oracle_diff.Sink.oyoy - (parameter) float yy / 64 * (field) float font_libraries_raster_oracle_diff.Sink.kk;
void void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogclineTo(float (parameter) float xx, float (parameter) float yy) nothrow @nogc
{
(field) font_libraries_raster_oracle_diff.Rasterizer* font_libraries_raster_oracle_diff.Sink.rr.void font_libraries_raster_oracle_diff.Rasterizer.line(float x0, float y0, float x1, float y1) pure nothrow @nogc @safeline(float font_libraries_raster_oracle_diff.Sink.sx(float x) const nothrow @nogcsx((field) float font_libraries_raster_oracle_diff.Sink.pxpx), float font_libraries_raster_oracle_diff.Sink.sy(float y) const nothrow @nogcsy((field) float font_libraries_raster_oracle_diff.Sink.pypy), float font_libraries_raster_oracle_diff.Sink.sx(float x) const nothrow @nogcsx((parameter) float xx), float font_libraries_raster_oracle_diff.Sink.sy(float y) const nothrow @nogcsy((parameter) float yy));
(field) float font_libraries_raster_oracle_diff.Sink.pxpx = (parameter) float xx;
(field) float font_libraries_raster_oracle_diff.Sink.pypy = (parameter) float yy;
(field) bool font_libraries_raster_oracle_diff.Sink.drewdrew = 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 @nogconMove((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void* (parameter) void* dd, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_draw_state_t*, float (parameter) float xx, float (parameter) float yy, void*)
{
auto (local variable) font_libraries_raster_oracle_diff.Sink* ss = cast((struct) font_libraries_raster_oracle_diff.SinkSink*) (parameter) void* dd;
(local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pxpx = (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.startXstartX = (parameter) float xx;
(local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pypy = (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.startYstartY = (parameter) float yy;
}
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 @nogconLine((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void* (parameter) void* dd, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_draw_state_t*, float (parameter) float xx, float (parameter) float yy, void*)
{
(cast((struct) font_libraries_raster_oracle_diff.SinkSink*) (parameter) void* dd).void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogclineTo((parameter) float xx, (parameter) float yy);
}
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 @nogconQuad((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void* (parameter) void* dd, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_draw_state_t*,
float (parameter) float cxcx, float (parameter) float cycy, float (parameter) float xx, float (parameter) float yy, void*)
{
auto (local variable) font_libraries_raster_oracle_diff.Sink* ss = cast((struct) font_libraries_raster_oracle_diff.SinkSink*) (parameter) void* dd;
const (local variable) const(float) x0x0 = (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pxpx, (local variable) const(float) y0y0 = (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pypy;
int (local variable) int nn;
if ((local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) bool font_libraries_raster_oracle_diff.Sink.freetypeFlatteningfreetypeFlattening)
{
// ftgrays.c gray_render_conic: each bisection quarters the deviation.
float (local variable) float devdev = float std.algorithm.comparison.max!(float, float)(float a, float b) pure nothrow @nogc @safeIterates 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);
max(float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safeCalculates 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);
abs((local variable) const(float) x0x0 + (parameter) float xx - 2 * (parameter) float cxcx), float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safeCalculates 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);
abs((local variable) const(float) y0y0 + (parameter) float yy - 2 * (parameter) float cycy)) / 64 * (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.kk;
(local variable) int nn = 1;
if ((local variable) float devdev >= 0.25f)
do { (local variable) float devdev /= 4; (local variable) int nn *= 2; } while ((local variable) float devdev > 0.25f);
}
else // a quadratic's chord deviates by at most |p0 - 2c + p2| / (4 n^2)
(local variable) int nn = int std.algorithm.comparison.max!(int, int)(int a, int b) pure nothrow @nogc @safeIterates 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);
max(1, cast(int) float std.math.rounding.ceil(float x) pure nothrow @nogc @trustedceil(float std.math.algebraic.sqrt(float x) pure nothrow @nogc @safeCompute 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 @safeCalculates 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) x0x0 - 2 * (parameter) float cxcx + (parameter) float xx, (local variable) const(float) y0y0 - 2 * (parameter) float cycy + (parameter) float yy) / 64 / 4 / (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.tolerancetolerance)));
foreach ((local variable) int ii; 1 .. (local variable) int nn + 1)
{
const (local variable) const(float) tt = float((local variable) int ii) / (local variable) int nn, (local variable) const(float) uu = 1 - (local variable) const(float) tt;
(local variable) font_libraries_raster_oracle_diff.Sink* ss.void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogclineTo((local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) x0x0 + 2 * (local variable) const(float) uu * (local variable) const(float) tt * (parameter) float cxcx + (local variable) const(float) tt * (local variable) const(float) tt * (parameter) float xx, (local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) y0y0 + 2 * (local variable) const(float) uu * (local variable) const(float) tt * (parameter) float cycy + (local variable) const(float) tt * (local variable) const(float) tt * (parameter) float yy);
}
}
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 @nogconCubic((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void* (parameter) void* dd, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_draw_state_t*,
float (parameter) float c1xc1x, float (parameter) float c1yc1y, float (parameter) float c2xc2x, float (parameter) float c2yc2y, float (parameter) float xx, float (parameter) float yy, void*)
{
auto (local variable) font_libraries_raster_oracle_diff.Sink* ss = cast((struct) font_libraries_raster_oracle_diff.SinkSink*) (parameter) void* dd;
const (local variable) const(float) x0x0 = (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pxpx, (local variable) const(float) y0y0 = (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pypy;
if ((local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) bool font_libraries_raster_oracle_diff.Sink.freetypeFlatteningfreetypeFlattening)
{
// ftgrays.c gray_render_cubic: bisect until the control points lie
// within half a pixel of the trisection test.
const (local variable) const(float) limitlimit = 0.5f * 64 / (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.kk;
void void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @systemsplit(float[8] (parameter) float[8] aa, int (parameter) int depthdepth)
{
if ((parameter) int depthdepth < 16
&& (float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safeCalculates 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);
abs(2 * (parameter) float[8] aa[0] - 3 * (parameter) float[8] aa[2] + (parameter) float[8] aa[6]) > (local variable) const(float) limitlimit || float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safeCalculates 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);
abs(2 * (parameter) float[8] aa[1] - 3 * (parameter) float[8] aa[3] + (parameter) float[8] aa[7]) > (local variable) const(float) limitlimit
|| float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safeCalculates 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);
abs((parameter) float[8] aa[0] - 3 * (parameter) float[8] aa[4] + 2 * (parameter) float[8] aa[6]) > (local variable) const(float) limitlimit || float std.math.algebraic.abs!float(float x) pure nothrow @nogc @safeCalculates 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);
abs((parameter) float[8] aa[1] - 3 * (parameter) float[8] aa[5] + 2 * (parameter) float[8] aa[7]) > (local variable) const(float) limitlimit))
{
const (local variable) const(float) m01xm01x = ((parameter) float[8] aa[0] + (parameter) float[8] aa[2]) / 2, (local variable) const(float) m01ym01y = ((parameter) float[8] aa[1] + (parameter) float[8] aa[3]) / 2;
const (local variable) const(float) m12xm12x = ((parameter) float[8] aa[2] + (parameter) float[8] aa[4]) / 2, (local variable) const(float) m12ym12y = ((parameter) float[8] aa[3] + (parameter) float[8] aa[5]) / 2;
const (local variable) const(float) m23xm23x = ((parameter) float[8] aa[4] + (parameter) float[8] aa[6]) / 2, (local variable) const(float) m23ym23y = ((parameter) float[8] aa[5] + (parameter) float[8] aa[7]) / 2;
const (local variable) const(float) axax = ((local variable) const(float) m01xm01x + (local variable) const(float) m12xm12x) / 2, (local variable) const(float) ayay = ((local variable) const(float) m01ym01y + (local variable) const(float) m12ym12y) / 2;
const (local variable) const(float) bxbx = ((local variable) const(float) m12xm12x + (local variable) const(float) m23xm23x) / 2, (local variable) const(float) byby = ((local variable) const(float) m12ym12y + (local variable) const(float) m23ym23y) / 2;
const (local variable) const(float) mxmx = ((local variable) const(float) axax + (local variable) const(float) bxbx) / 2, (local variable) const(float) mymy = ((local variable) const(float) ayay + (local variable) const(float) byby) / 2;
void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @systemsplit([(parameter) float[8] aa[0], (parameter) float[8] aa[1], (local variable) const(float) m01xm01x, (local variable) const(float) m01ym01y, (local variable) const(float) axax, (local variable) const(float) ayay, (local variable) const(float) mxmx, (local variable) const(float) mymy], (parameter) int depthdepth + 1);
void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @systemsplit([(local variable) const(float) mxmx, (local variable) const(float) mymy, (local variable) const(float) bxbx, (local variable) const(float) byby, (local variable) const(float) m23xm23x, (local variable) const(float) m23ym23y, (parameter) float[8] aa[6], (parameter) float[8] aa[7]], (parameter) int depthdepth + 1);
}
else
(local variable) font_libraries_raster_oracle_diff.Sink* ss.void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogclineTo((parameter) float[8] aa[6], (parameter) float[8] aa[7]);
}
void font_libraries_raster_oracle_diff.onCubic.split(float[8] a, int depth) nothrow @nogc @systemsplit([(local variable) const(float) x0x0, (local variable) const(float) y0y0, (parameter) float c1xc1x, (parameter) float c1yc1y, (parameter) float c2xc2x, (parameter) float c2yc2y, (parameter) float xx, (parameter) float yy], 0);
return;
}
// A cubic's chord deviates by at most 3/4 of its largest second difference / n^2.
const (local variable) const(float) dddd = float std.algorithm.comparison.max!(float, float)(float a, float b) pure nothrow @nogc @safeIterates 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);
max(float std.math.algebraic.hypot!float(const(float) x, const(float) y) pure nothrow @nogc @safeCalculates 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) x0x0 - 2 * (parameter) float c1xc1x + (parameter) float c2xc2x, (local variable) const(float) y0y0 - 2 * (parameter) float c1yc1y + (parameter) float c2yc2y), float std.math.algebraic.hypot!float(const(float) x, const(float) y) pure nothrow @nogc @safeCalculates 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 c1xc1x - 2 * (parameter) float c2xc2x + (parameter) float xx, (parameter) float c1yc1y - 2 * (parameter) float c2yc2y + (parameter) float yy));
const (local variable) const(int) nn = int std.algorithm.comparison.max!(int, int)(int a, int b) pure nothrow @nogc @safeIterates 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);
max(1, cast(int) float std.math.rounding.ceil(float x) pure nothrow @nogc @trustedceil(float std.math.algebraic.sqrt(float x) pure nothrow @nogc @safeCompute square root of x.
x sqrt(x) invalid? -0.0 -0.0 no <0.0 yes + + no
sqrt((local variable) const(float) dddd * 0.75f / 64 / (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.tolerancetolerance)));
foreach ((local variable) int ii; 1 .. (local variable) const(int) nn + 1)
{
const (local variable) const(float) tt = float((local variable) int ii) / (local variable) const(int) nn, (local variable) const(float) uu = 1 - (local variable) const(float) tt;
(local variable) font_libraries_raster_oracle_diff.Sink* ss.void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogclineTo((local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) x0x0 + 3 * (local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) tt * (parameter) float c1xc1x + 3 * (local variable) const(float) uu * (local variable) const(float) tt * (local variable) const(float) tt * (parameter) float c2xc2x + (local variable) const(float) tt * (local variable) const(float) tt * (local variable) const(float) tt * (parameter) float xx,
(local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) y0y0 + 3 * (local variable) const(float) uu * (local variable) const(float) uu * (local variable) const(float) tt * (parameter) float c1yc1y + 3 * (local variable) const(float) uu * (local variable) const(float) tt * (local variable) const(float) tt * (parameter) float c2yc2y + (local variable) const(float) tt * (local variable) const(float) tt * (local variable) const(float) tt * (parameter) float yy);
}
}
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 @nogconClose((struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t*, void* (parameter) void* dd, (struct) font_libraries_raster_oracle_diff.hb_draw_state_thb_draw_state_t*, void*)
{
auto (local variable) font_libraries_raster_oracle_diff.Sink* ss = cast((struct) font_libraries_raster_oracle_diff.SinkSink*) (parameter) void* dd;
if ((local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pxpx != (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.startXstartX || (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.pypy != (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.startYstartY)
(local variable) font_libraries_raster_oracle_diff.Sink* ss.void font_libraries_raster_oracle_diff.Sink.lineTo(float x, float y) nothrow @nogclineTo((local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.startXstartX, (local variable) font_libraries_raster_oracle_diff.Sink* ss.(field) float font_libraries_raster_oracle_diff.Sink.startYstartY);
}
// ---------------------------------------------------------------------------
/// 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 @safePer 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)[] dd) @safe pure
{
uint uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16((alias) object.size_t = ulongsize_t (parameter) ulong oo) => (parameter) ulong oo + 2 <= (parameter) const(ubyte)[] dd.(field) ulong const(ubyte)[].lengthlength ? ((parameter) const(ubyte)[] dd[(parameter) ulong oo] << 8) | (parameter) const(ubyte)[] dd[(parameter) ulong oo + 1] : 0;
uint uint font_libraries_raster_oracle_diff.overlapFlags.u32(ulong o) pure nothrow @nogc @safeu32((alias) object.size_t = ulongsize_t (parameter) ulong oo) => (parameter) ulong oo + 4 <= (parameter) const(ubyte)[] dd.(field) ulong const(ubyte)[].lengthlength
? (uint((parameter) const(ubyte)[] dd[(parameter) ulong oo]) << 24) | ((parameter) const(ubyte)[] dd[(parameter) ulong oo + 1] << 16) | ((parameter) const(ubyte)[] dd[(parameter) ulong oo + 2] << 8) | (parameter) const(ubyte)[] dd[(parameter) ulong oo + 3] : 0;
(alias) object.size_t = ulongsize_t (local variable) ulong headhead, (local variable) ulong localoca, (local variable) ulong glyfglyf, (local variable) ulong maxpmaxp;
foreach ((local variable) uint ii; 0 .. uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16(4))
{
const (local variable) const(uint) rr = 12 + (local variable) uint ii * 16, (local variable) const(uint) offoff = uint font_libraries_raster_oracle_diff.overlapFlags.u32(ulong o) pure nothrow @nogc @safeu32((local variable) const(uint) rr + 8);
switch (cast(const(char)[]) (parameter) const(ubyte)[] dd[(local variable) const(uint) rr .. (local variable) const(uint) rr + 4])
{
case "head": (local variable) ulong headhead = (local variable) const(uint) offoff; break;
case "loca": (local variable) ulong localoca = (local variable) const(uint) offoff; break;
case "glyf": (local variable) ulong glyfglyf = (local variable) const(uint) offoff; break;
case "maxp": (local variable) ulong maxpmaxp = (local variable) const(uint) offoff; break;
default: break;
}
}
if (!(local variable) ulong glyfglyf || !(local variable) ulong localoca || !(local variable) ulong headhead || !(local variable) ulong maxpmaxp)
return null;
const (local variable) const(bool) longOffsetslongOffsets = uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16((local variable) ulong headhead + 50) == 1;
(alias) object.size_t = ulongsize_t ulong font_libraries_raster_oracle_diff.overlapFlags.offset(ulong g) pure nothrow @nogc @safeoffset((alias) object.size_t = ulongsize_t (parameter) ulong gg) => (local variable) ulong glyfglyf + ((local variable) const(bool) longOffsetslongOffsets ? uint font_libraries_raster_oracle_diff.overlapFlags.u32(ulong o) pure nothrow @nogc @safeu32((local variable) ulong localoca + (parameter) ulong gg * 4) : uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16((local variable) ulong localoca + (parameter) ulong gg * 2) * 2);
auto (local variable) bool[] flagsflags = new bool[uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16((local variable) ulong maxpmaxp + 4)];
foreach ((parameter) ulong gg, ref (parameter) bool flagflag; (local variable) bool[] flagsflags)
{
const (local variable) const(ulong) startstart = ulong font_libraries_raster_oracle_diff.overlapFlags.offset(ulong g) pure nothrow @nogc @safeoffset((local variable) ulong gg);
if (ulong font_libraries_raster_oracle_diff.overlapFlags.offset(ulong g) pure nothrow @nogc @safeoffset((local variable) ulong gg + 1) <= (local variable) const(ulong) startstart)
continue;
const (local variable) const(short) contourscontours = cast(short) uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16((local variable) const(ulong) startstart);
if ((local variable) const(short) contourscontours > 0)
{
const (local variable) const(ulong) instructionsinstructions = (local variable) const(ulong) startstart + 10 + (local variable) const(short) contourscontours * 2;
const (local variable) const(ulong) firstFlagfirstFlag = (local variable) const(ulong) instructionsinstructions + 2 + uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16((local variable) const(ulong) instructionsinstructions);
(local variable) bool flagflag = (local variable) const(ulong) firstFlagfirstFlag < (parameter) const(ubyte)[] dd.(field) ulong const(ubyte)[].lengthlength && ((parameter) const(ubyte)[] dd[(local variable) const(ulong) firstFlagfirstFlag] & 0x40) != 0;
}
else if ((local variable) const(short) contourscontours < 0)
for ((alias) object.size_t = ulongsize_t (local variable) ulong pp = (local variable) const(ulong) startstart + 10;;)
{
const (local variable) const(uint) ff = uint font_libraries_raster_oracle_diff.overlapFlags.u16(ulong o) pure nothrow @nogc @safeu16((local variable) ulong pp);
if ((local variable) const(uint) ff & 0x0400)
{
(local variable) bool flagflag = true;
break;
}
if (!((local variable) const(uint) ff & 0x20)) // MORE_COMPONENTS
break;
(local variable) ulong pp += 4 + (((local variable) const(uint) ff & 1) ? 4 : 2) + (((local variable) const(uint) ff & 8) ? 2 : ((local variable) const(uint) ff & 0x40) ? 4 : ((local variable) const(uint) ff & 0x80) ? 8 : 0);
}
}
return (local variable) bool[] flagsflags;
}
ubyte ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safepercentile(const(ubyte)[] (parameter) const(ubyte)[] sortedsorted, double (parameter) double pp) @safe pure nothrow @nogc
=> (parameter) const(ubyte)[] sortedsorted.(field) ulong const(ubyte)[].lengthlength ? (parameter) const(ubyte)[] sortedsorted[ulong std.algorithm.comparison.min!(ulong, ulong)(ulong a, ulong b) pure nothrow @nogc @safeIterates 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);
min((parameter) const(ubyte)[] sortedsorted.(field) ulong const(ubyte)[].lengthlength - 1, cast((alias) object.size_t = ulongsize_t)((parameter) double pp / 100 * (parameter) const(ubyte)[] sortedsorted.(field) ulong const(ubyte)[].lengthlength))] : 0;
/// What a row compares, and against what.
enum (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode
{
(enum value) font_libraries_raster_oracle_diff.Mode.production = 0D, 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 = 1D 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 = 2D 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 = 3D 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_thb_font_t* (parameter) font_libraries_raster_oracle_diff.hb_font_t* fontfont, (struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t* (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, uint (parameter) uint gidgid, uint (parameter) uint ww, uint (parameter) uint hh,
int (parameter) int leftleft, int (parameter) int toptop, int (parameter) int ssss, bool (parameter) bool freetypeFlatteningfreetypeFlattening, float (parameter) float tolerancetolerance, out bool (parameter) bool drewdrew)
{
auto (local variable) font_libraries_raster_oracle_diff.Rasterizer* rr = new (struct) font_libraries_raster_oracle_diff.RasterizerRasterizer((parameter) uint ww * (parameter) int ssss, (parameter) uint hh * (parameter) int ssss);
auto (local variable) font_libraries_raster_oracle_diff.Sink sinksink = (struct) font_libraries_raster_oracle_diff.SinkSink((local variable) font_libraries_raster_oracle_diff.Rasterizer* rr, (parameter) int ssss * ((constant) int font_libraries_raster_oracle_diff.margin = 4margin - (parameter) int leftleft), (parameter) int ssss * ((constant) int font_libraries_raster_oracle_diff.margin = 4margin + (parameter) int toptop), (parameter) int ssss, (parameter) bool freetypeFlatteningfreetypeFlattening, (parameter) float tolerancetolerance);
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 @nogchb_font_draw_glyph((parameter) font_libraries_raster_oracle_diff.hb_font_t* fontfont, (parameter) uint gidgid, (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, &(local variable) font_libraries_raster_oracle_diff.Sink sinksink);
(parameter) bool drewdrew = (local variable) font_libraries_raster_oracle_diff.Sink sinksink.(field) bool font_libraries_raster_oracle_diff.Sink.drewdrew;
const (local variable) const(ubyte[]) finefine = (local variable) font_libraries_raster_oracle_diff.Rasterizer* rr.ubyte[] font_libraries_raster_oracle_diff.Rasterizer.coverage() const pure nothrow @safecoverage();
if ((parameter) int ssss == 1)
return (local variable) const(ubyte[]) finefine.ubyte[] object.dup!ubyte(const(ubyte)[] a) pure nothrow @property @safedup;
auto (local variable) ubyte[] out_out_ = new ubyte[(parameter) uint ww * (parameter) uint hh];
foreach ((local variable) uint yy; 0 .. (parameter) uint hh)
foreach ((local variable) uint xx; 0 .. (parameter) uint ww)
{
uint (local variable) uint sumsum;
foreach ((local variable) int jj; 0 .. (parameter) int ssss)
foreach ((local variable) int ii; 0 .. (parameter) int ssss)
(local variable) uint sumsum += (local variable) const(ubyte[]) finefine[((local variable) uint yy * (parameter) int ssss + (local variable) int jj) * (parameter) uint ww * (parameter) int ssss + (local variable) uint xx * (parameter) int ssss + (local variable) int ii];
(local variable) ubyte[] out_out_[(local variable) uint yy * (parameter) uint ww + (local variable) uint xx] = cast(ubyte)(((local variable) uint sumsum + (parameter) int ssss * (parameter) int ssss / 2) / ((parameter) int ssss * (parameter) int ssss));
}
return (local variable) ubyte[] out_out_;
}
enum (constant) int font_libraries_raster_oracle_diff.margin = 4margin = 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_FaceRecFT_FaceRec* (parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ftft, (struct) font_libraries_raster_oracle_diff.hb_font_thb_font_t* (parameter) font_libraries_raster_oracle_diff.hb_font_t* fontfont, (struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t* (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, const(bool)[] (parameter) const(bool)[] overlapoverlap,
uint (parameter) uint glyphsglyphs, int (parameter) int ppemppem, (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode (parameter) font_libraries_raster_oracle_diff.Mode modemode)
{
void font_libraries_raster_oracle_diff.hb_font_set_scale(font_libraries_raster_oracle_diff.hb_font_t*, int, int) nothrow @nogchb_font_set_scale((parameter) font_libraries_raster_oracle_diff.hb_font_t* fontfont, (parameter) int ppemppem * 64, (parameter) int ppemppem * 64);
int font_libraries_raster_oracle_diff.FT_Set_Pixel_Sizes(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint width, uint height) nothrow @nogcFT_Set_Pixel_Sizes((parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ftft, 0, (parameter) int ppemppem);
ubyte[] (local variable) ubyte[] pixelspixels, (local variable) ubyte[] glyphMaxglyphMax;
foreach ((local variable) uint gidgid; 0 .. (parameter) uint glyphsglyphs)
{
if (int font_libraries_raster_oracle_diff.FT_Load_Glyph(font_libraries_raster_oracle_diff.FT_FaceRec* face, uint glyph, int flags) nothrow @nogcFT_Load_Glyph((parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ftft, (local variable) uint gidgid, (constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_HINTING = 2FT_LOAD_NO_HINTING | (constant) int font_libraries_raster_oracle_diff.FT_LOAD_RENDER = 4FT_LOAD_RENDER | (constant) int font_libraries_raster_oracle_diff.FT_LOAD_NO_BITMAP = 8FT_LOAD_NO_BITMAP) != 0)
continue;
const (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm = (parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ftft.(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyphglyph.(field) font_libraries_raster_oracle_diff.FT_Bitmap font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmapbitmap;
if ((local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) ubyte font_libraries_raster_oracle_diff.FT_Bitmap.pixel_modepixel_mode != (constant) int font_libraries_raster_oracle_diff.FT_PIXEL_MODE_GRAY = 2FT_PIXEL_MODE_GRAY)
continue;
const (local variable) const(bool) flaggedflagged = (local variable) uint gidgid < (parameter) const(bool)[] overlapoverlap.(field) ulong const(bool)[].lengthlength && (parameter) const(bool)[] overlapoverlap[(local variable) uint gidgid];
if ((parameter) font_libraries_raster_oracle_diff.Mode modemode == (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.unflagged = 3D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag
unflagged && (local variable) const(bool) flaggedflagged)
continue;
const (local variable) const(uint) ww = (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.widthwidth + 2 * (constant) int font_libraries_raster_oracle_diff.margin = 4margin, (local variable) const(uint) hh = (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.rowsrows + 2 * (constant) int font_libraries_raster_oracle_diff.margin = 4margin;
const (local variable) const(int) leftleft = (parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ftft.(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyphglyph.(field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_leftbitmap_left, (local variable) const(int) toptop = (parameter) font_libraries_raster_oracle_diff.FT_FaceRec* ftft.(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyphglyph.(field) int font_libraries_raster_oracle_diff.FT_GlyphSlotRec.bitmap_topbitmap_top;
bool (local variable) bool drewdrew, (local variable) bool unusedunused;
const (local variable) const(ubyte[]) oursours = 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* fontfont, (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, (local variable) uint gidgid, (local variable) const(uint) ww, (local variable) const(uint) hh, (local variable) const(int) leftleft, (local variable) const(int) toptop, (local variable) const(bool) flaggedflagged ? 4 : 1,
(parameter) font_libraries_raster_oracle_diff.Mode modemode == (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.ftFlatten = 1D with FreeType's flattening rules — vs FreeType
ftFlatten, 0.02f, (local variable) bool drewdrew);
if (!(local variable) bool drewdrew && (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.widthwidth == 0)
continue;
ubyte[] (local variable) ubyte[] referencereference;
if ((parameter) font_libraries_raster_oracle_diff.Mode modemode == (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.fineReference = 2D at 0.02 px — vs D at 0.001 px: the flattening error alone
fineReference)
(local variable) ubyte[] referencereference = 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* fontfont, (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, (local variable) uint gidgid, (local variable) const(uint) ww, (local variable) const(uint) hh, (local variable) const(int) leftleft, (local variable) const(int) toptop, (local variable) const(bool) flaggedflagged ? 4 : 1, false, 0.001f, (local variable) bool unusedunused);
else if ((parameter) font_libraries_raster_oracle_diff.Mode modemode == (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.unflagged = 3D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag
unflagged)
(local variable) ubyte[] referencereference = 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* fontfont, (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, (local variable) uint gidgid, (local variable) const(uint) ww, (local variable) const(uint) hh, (local variable) const(int) leftleft, (local variable) const(int) toptop, 4, false, 0.02f, (local variable) bool unusedunused);
else
{
(local variable) ubyte[] referencereference = new ubyte[(local variable) const(uint) ww * (local variable) const(uint) hh];
foreach ((local variable) uint fyfy; 0 .. (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.rowsrows)
foreach ((local variable) uint fxfx; 0 .. (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) uint font_libraries_raster_oracle_diff.FT_Bitmap.widthwidth)
(local variable) ubyte[] referencereference[((local variable) uint fyfy + (constant) int font_libraries_raster_oracle_diff.margin = 4margin) * (local variable) const(uint) ww + (local variable) uint fxfx + (constant) int font_libraries_raster_oracle_diff.margin = 4margin] = (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) ubyte* font_libraries_raster_oracle_diff.FT_Bitmap.bufferbuffer[(local variable) uint fyfy * (local variable) const(font_libraries_raster_oracle_diff.FT_Bitmap) bmbm.(field) int font_libraries_raster_oracle_diff.FT_Bitmap.pitchpitch + (local variable) uint fxfx];
}
ubyte (local variable) ubyte worstworst;
foreach ((local variable) uint ii; 0 .. (local variable) const(uint) ww * (local variable) const(uint) hh)
{
if (!(local variable) const(ubyte[]) oursours[(local variable) uint ii] && !(local variable) ubyte[] referencereference[(local variable) uint ii])
continue;
const (local variable) const(ubyte) diffdiff = cast(ubyte) int std.math.algebraic.abs!int(int x) pure nothrow @nogc @safeCalculates 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);
abs(int((local variable) const(ubyte[]) oursours[(local variable) uint ii]) - int((local variable) ubyte[] referencereference[(local variable) uint ii]));
(local variable) ubyte[] pixelspixels ~= (local variable) const(ubyte) diffdiff;
(local variable) ubyte worstworst = ubyte std.algorithm.comparison.max!(ubyte, const(ubyte))(ubyte __param_0, const(ubyte) __param_1) pure nothrow @nogc @safeIterates the passed arguments and returns the maximum value.
max((local variable) ubyte worstworst, (local variable) const(ubyte) diffdiff);
}
(local variable) ubyte[] glyphMaxglyphMax ~= (local variable) ubyte worstworst;
}
(local variable) ubyte[] pixelspixels.std.range.SortedRange!(ubyte[], "a < b", SortedRangeOptions.assumeSorted) std.algorithm.sorting.sort!("a < b", SwapStrategy.unstable, ubyte[])(ubyte[] r) pure nothrow @nogc @safeSorts 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));
sort();
(local variable) ubyte[] glyphMaxglyphMax.std.range.SortedRange!(ubyte[], "a < b", SortedRangeOptions.assumeSorted) std.algorithm.sorting.sort!("a < b", SwapStrategy.unstable, ubyte[])(ubyte[] r) pure nothrow @nogc @safeSorts 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));
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) @safeEquivalent 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 modemode, (parameter) int ppemppem, (local variable) ubyte[] glyphMaxglyphMax.(field) ulong ubyte[].lengthlength,
(local variable) ubyte[] pixelspixels.ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safepercentile(50), (local variable) ubyte[] pixelspixels.ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safepercentile(99), (local variable) ubyte[] pixelspixels.(field) ulong ubyte[].lengthlength ? (local variable) ubyte[] pixelspixels[$ - 1] : 0,
(local variable) ubyte[] glyphMaxglyphMax.ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safepercentile(50), (local variable) ubyte[] glyphMaxglyphMax.ubyte font_libraries_raster_oracle_diff.percentile(const(ubyte)[] sorted, double p) pure nothrow @nogc @safepercentile(99), (local variable) ubyte[] glyphMaxglyphMax.ulong font_libraries_raster_oracle_diff.compare.count!((m) => m > 32, ubyte[])(ubyte[] haystack) pure nothrow @nogc @safeCounts 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);
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* librarylibrary, (struct) font_libraries_raster_oracle_diff.hb_draw_funcs_thb_draw_funcs_t* (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, (alias) object.string = stringstring (parameter) string pathpath)
{
auto (local variable) font_libraries_raster_oracle_diff.hb_blob_t* blobblob = font_libraries_raster_oracle_diff.hb_blob_t* font_libraries_raster_oracle_diff.hb_blob_create_from_file(const(char)*) nothrow @nogchb_blob_create_from_file((parameter) string pathpath.immutable(char)* std.string.toStringz(scope const(char)[] s) pure nothrow @trustedExamples
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(""));
toStringz);
scope (exit) void font_libraries_raster_oracle_diff.hb_blob_destroy(font_libraries_raster_oracle_diff.hb_blob_t*) nothrow @nogchb_blob_destroy((local variable) font_libraries_raster_oracle_diff.hb_blob_t* blobblob);
if (uint font_libraries_raster_oracle_diff.hb_blob_get_length(font_libraries_raster_oracle_diff.hb_blob_t*) nothrow @nogchb_blob_get_length((local variable) font_libraries_raster_oracle_diff.hb_blob_t* blobblob) == 0)
{
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safeEquivalent 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);
}
}
writeln("SKIP: empty blob for ", (parameter) string pathpath);
return;
}
auto (local variable) font_libraries_raster_oracle_diff.hb_face_t* faceface = 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 @nogchb_face_create((local variable) font_libraries_raster_oracle_diff.hb_blob_t* blobblob, 0);
scope (exit) void font_libraries_raster_oracle_diff.hb_face_destroy(font_libraries_raster_oracle_diff.hb_face_t*) nothrow @nogchb_face_destroy((local variable) font_libraries_raster_oracle_diff.hb_face_t* faceface);
auto (local variable) font_libraries_raster_oracle_diff.hb_font_t* fontfont = 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 @nogchb_font_create((local variable) font_libraries_raster_oracle_diff.hb_face_t* faceface);
scope (exit) void font_libraries_raster_oracle_diff.hb_font_destroy(font_libraries_raster_oracle_diff.hb_font_t*) nothrow @nogchb_font_destroy((local variable) font_libraries_raster_oracle_diff.hb_font_t* fontfont);
(struct) font_libraries_raster_oracle_diff.FT_FaceRecFT_FaceRec* (local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft;
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 @nogcFT_New_Face((parameter) void* librarylibrary, (parameter) string pathpath.immutable(char)* std.string.toStringz(scope const(char)[] s) pure nothrow @trustedExamples
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(""));
toStringz, 0, &(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft) != 0)
{
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safeEquivalent 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);
}
}
writeln("SKIP: FreeType cannot open ", (parameter) string pathpath);
return;
}
scope (exit) int font_libraries_raster_oracle_diff.FT_Done_Face(font_libraries_raster_oracle_diff.FT_FaceRec* face) nothrow @nogcFT_Done_Face((local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft);
const (local variable) const(uint) glyphsglyphs = uint font_libraries_raster_oracle_diff.hb_face_get_glyph_count(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogchb_face_get_glyph_count((local variable) font_libraries_raster_oracle_diff.hb_face_t* faceface);
// The declared FreeType layout must agree with HarfBuzz before any pixel counts.
if ((local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft.(field) ushort font_libraries_raster_oracle_diff.FT_FaceRec.units_per_EMunits_per_EM != uint font_libraries_raster_oracle_diff.hb_face_get_upem(const(font_libraries_raster_oracle_diff.hb_face_t)*) nothrow @nogchb_face_get_upem((local variable) font_libraries_raster_oracle_diff.hb_face_t* faceface) || (local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft.(field) long font_libraries_raster_oracle_diff.FT_FaceRec.num_glyphsnum_glyphs != (local variable) const(uint) glyphsglyphs || (local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft.(field) font_libraries_raster_oracle_diff.FT_GlyphSlotRec* font_libraries_raster_oracle_diff.FT_FaceRec.glyphglyph.(field) font_libraries_raster_oracle_diff.FT_FaceRec* font_libraries_raster_oracle_diff.FT_GlyphSlotRec.faceface != (local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft)
{
void std.stdio.writeln!(string, string)(string __param_0, string __param_1) @safeEquivalent 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);
}
}
writeln("FAIL: FT_FaceRec layout disagrees with HarfBuzz for ", (parameter) string pathpath);
return;
}
const (local variable) const(bool[]) overlapoverlap = bool[] font_libraries_raster_oracle_diff.overlapFlags(const(ubyte)[] d) pure @safePer 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) @safeRead 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);
read((parameter) string pathpath));
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) @safeEquivalent to writef(fmt, args, '\n').
writefln("%s: %d glyphs, upem %d, %d flagged overlapping", (parameter) string pathpath.string std.path.baseName!(immutable(char))(return scope string path) pure nothrow @nogc @safeNote
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");
baseName, (local variable) const(uint) glyphsglyphs,
(local variable) font_libraries_raster_oracle_diff.FT_FaceRec* ftft.(field) ushort font_libraries_raster_oracle_diff.FT_FaceRec.units_per_EMunits_per_EM, (local variable) const(bool[]) overlapoverlap.ulong std.algorithm.searching.count!("a == b", const(bool)[], bool)(const(bool)[] haystack, bool needle) pure nothrow @nogc @safeCounts 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);
count(true));
foreach ((parameter) font_libraries_raster_oracle_diff.Mode modemode; [(enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.production = 0D, 0.02 px flattening, FreeType's overlap rule — vs FreeType
production, (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.ftFlatten = 1D with FreeType's flattening rules — vs FreeType
ftFlatten, (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.fineReference = 2D at 0.02 px — vs D at 0.001 px: the flattening error alone
fineReference, (enum) font_libraries_raster_oracle_diff.ModeWhat a row compares, and against what.
Mode.(enum value) font_libraries_raster_oracle_diff.Mode.unflagged = 3D on unflagged glyphs — vs D at 4x4: overlaps the font does not flag
unflagged])
foreach ((parameter) int ppemppem; [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* ftft, (local variable) font_libraries_raster_oracle_diff.hb_font_t* fontfont, (parameter) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, (local variable) const(bool[]) overlapoverlap, (local variable) const(uint) glyphsglyphs, (local variable) int ppemppem, (local variable) font_libraries_raster_oracle_diff.Mode modemode);
}
(alias) object.string = stringstring[] string[] font_libraries_raster_oracle_diff.resolveFonts(string[] args)resolveFonts((alias) object.string = stringstring[] (parameter) string[] argsargs)
{
(alias) object.string = stringstring[] (local variable) string[] givengiven;
foreach ((parameter) string aa; (parameter) string[] argsargs[1 .. $])
if (bool std.file.exists!string(string name) nothrow @nogc @safeDetermine whether the given file (or directory) exists.
exists((local variable) string aa))
(local variable) string[] givengiven ~= (local variable) string aa;
if ((local variable) string[] givengiven.(field) ulong string[].lengthlength)
return (local variable) string[] givengiven;
try
{
auto (local variable) std.typecons.Tuple!(int, "status", string, "output") rr = 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) @safeExecutes 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.)
execute(["fc-match", "-f", "%{file}", "monospace"]);
if ((local variable) std.typecons.Tuple!(int, "status", string, "output") rr.status == 0 && (field) int std.typecons.Tuple!(int, "status", string, "output").__expand_field_0r.output.string std.string.strip!string(string str) pure nothrow @nogc @safeStrips 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");
strip.(field) string std.typecons.Tuple!(int, "status", string, "output").__expand_field_1length && bool std.file.exists!string(string name) nothrow @nogc @safeDetermine whether the given file (or directory) exists.
exists((local variable) std.typecons.Tuple!(int, "status", string, "output") rr.output.string std.string.strip!string(string str) pure nothrow @nogc @safeStrips 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");
strip))
return [(local variable) std.typecons.Tuple!(int, "status", string, "output") rr.output.string std.string.strip!string(string str) pure nothrow @nogc @safeStrips 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");
strip];
}
catch ((class) object.ExceptionThe 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 = stringstring[] (parameter) string[] argsargs)
{
const (local variable) const(string[]) fontsfonts = string[] font_libraries_raster_oracle_diff.resolveFonts(string[] args)resolveFonts((parameter) string[] argsargs);
if (!(local variable) const(string[]) fontsfonts.(field) ulong const(string[]).lengthlength)
{
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
writeln("SKIP: no font file resolved (pass paths, or install fontconfig)");
return 0;
}
void* (local variable) void* librarylibrary;
if (int font_libraries_raster_oracle_diff.FT_Init_FreeType(void** library) nothrow @nogcFT_Init_FreeType(&(local variable) void* librarylibrary) != 0)
{
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
writeln("SKIP: FreeType failed to initialize");
return 0;
}
scope (exit) int font_libraries_raster_oracle_diff.FT_Done_FreeType(void* library) nothrow @nogcFT_Done_FreeType((local variable) void* librarylibrary);
auto (local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs = font_libraries_raster_oracle_diff.hb_draw_funcs_t* font_libraries_raster_oracle_diff.hb_draw_funcs_create() nothrow @nogchb_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 @nogchb_draw_funcs_destroy((local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs);
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 @nogchb_draw_funcs_set_move_to_func((local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, &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 @nogconMove, 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 @nogchb_draw_funcs_set_line_to_func((local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, &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 @nogconLine, 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 @nogchb_draw_funcs_set_quadratic_to_func((local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, &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 @nogconQuad, 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 @nogchb_draw_funcs_set_cubic_to_func((local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, &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 @nogconCubic, 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 @nogchb_draw_funcs_set_close_path_func((local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, &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 @nogconClose, null, null);
foreach ((parameter) const(string) pathpath; (local variable) const(string[]) fontsfonts)
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* librarylibrary, (local variable) font_libraries_raster_oracle_diff.hb_draw_funcs_t* funcsfuncs, (local variable) const(string) pathpath);
return 0;
}