#!/usr/bin/env dub
/+ dub.sdl:
name "font_libraries_harfbuzz_shape_features"
targetPath "build"
libs "harfbuzz"
buildType "checked" {
buildOptions "optimize" "inline" "debugInfo"
}
+/
/**
* HarfBuzz's whole object model in one program, pure D with hand-declared
* `extern(C)` prototypes — no FreeType, no C shim, no struct of HarfBuzz's is
* anything but plain data.
*
* Demonstrates, against a real font file:
*
* 1. The layering `hb_blob_t` → `hb_face_t` → `hb_font_t` → `hb_buffer_t`:
* bytes, then the immutable parsed face (`upem`, glyph count), then a
* face at a scale, then the mutable shaping buffer. Every object is
* reference-counted and opaque; the only structs that cross the boundary
* are the glyph info/position records and the feature/variation/axis
* descriptors.
* 2. `hb_ot_layout_table_get_feature_tags` — the feature inventory an
* inspector lists (`GSUB` and `GPOS` separately).
* 3. `hb_ot_var_get_axis_infos` — the `fvar` axes, and
* `hb_font_set_variations` setting one before shaping, so the advances a
* variable font reports move with the axis.
* 4. `hb_shape` with an explicit `hb_feature_t[]`: the same string shaped with
* `calt`+`liga` forced on and forced off. On a programming font with
* contextual ligatures (Maple Mono, Fira Code) the glyph sequence differs;
* on a font without them it is identical — both are findings.
* 5. Output units: `x_advance` is in font units scaled by `hb_font_set_scale`;
* here scale = upem so the numbers are design units.
*
* Companion to docs/research/font-libraries/harfbuzz.md § Analysis spine 1–4,
* and the catalog's RQ3/RQ5 (variation flow; inspector inventory).
*
* Run with: dub run --single harfbuzz-shape-features.d [-- /path/to/font.ttf]
*
* Font resolution: the first argument if given, else `fc-match -f %{file}
* monospace`. If neither yields a readable file (no fontconfig on the host,
* e.g. macOS CI), prints a `SKIP:` line and exits 0 so CI stays green.
*/
module (module) font_libraries_harfbuzz_shape_featuresHarfBuzz's whole object model in one program, pure D with hand-declared
extern(C) prototypes — no FreeType, no C shim, no struct of HarfBuzz's is
anything but plain data.
Demonstrates, against a real font file:
The layering hb_blob_t → hb_face_t → hb_font_t → hb_buffer_t:
bytes, then the immutable parsed face (upem, glyph count), then a
face at a scale, then the mutable shaping buffer. Every object is
reference-counted and opaque; the only structs that cross the boundary
are the glyph info/position records and the feature/variation/axis
descriptors.
hb_ot_layout_table_get_feature_tags — the feature inventory an
inspector lists (GSUB and GPOS separately).
hb_ot_var_get_axis_infos — the fvar axes, and
hb_font_set_variations setting one before shaping, so the advances a
variable font reports move with the axis.
hb_shape with an explicit hb_feature_t[]: the same string shaped with
calt+liga forced on and forced off. On a programming font with
contextual ligatures (Maple Mono, Fira Code) the glyph sequence differs;
on a font without them it is identical — both are findings.
Output units: x_advance is in font units scaled by hb_font_set_scale;
here scale = upem so the numbers are design units.
Companion to docs/research/font-libraries/harfbuzz.md § Analysis spine 1–4,
and the catalog's RQ3/RQ5 (variation flow; inspector inventory).
Run with: dub run --single harfbuzz-shape-features.d [-- /path/to/font.ttf]
Font resolution: the first argument if given, else fc-match -f %{file}
monospace. If neither yields a readable file (no fontconfig on the host,
e.g. macOS CI), prints a SKIP: line and exits 0 so CI stays green.
font_libraries_harfbuzz_shape_features;
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_harfbuzz_shape_features.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, (alias template) font_libraries_harfbuzz_shape_features.writefln = std.stdio.writefln(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))Equivalent to writef(fmt, args, '\n').
writefln;
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_harfbuzz_shape_features.fromStringz = std.string.fromStringz(Char)(return scope inout(Char)* cString) if (isSomeChar!Char)fromStringz, (alias) font_libraries_harfbuzz_shape_features.toStringz = immutable(char)* std.string.toStringz(scope const(char)[] s) pure nothrow @trustedtoStringz, (alias template) font_libraries_harfbuzz_shape_features.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;
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_harfbuzz_shape_features.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.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_harfbuzz_shape_features.exists = std.file.exists(R)(R name) if (isSomeFiniteCharInputRange!R && !isConvertibleToString!R)Determine whether the given file (or directory) exists.
exists;
// ---------------------------------------------------------------------------
// HarfBuzz C ABI, the subset this program needs. Layouts follow hb-common.h,
// hb-buffer.h and hb-ot-var.h: every field is a 32-bit scalar.
// ---------------------------------------------------------------------------
extern (C) nothrow @nogc
{
struct (struct) font_libraries_harfbuzz_shape_features.hb_blob_thb_blob_t;
struct (struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t;
struct (struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t;
struct (struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t;
alias (alias) font_libraries_harfbuzz_shape_features.hb_codepoint_t = uinthb_codepoint_t = uint;
alias (alias) font_libraries_harfbuzz_shape_features.hb_position_t = inthb_position_t = int;
alias (alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t = uint;
alias (alias) font_libraries_harfbuzz_shape_features.hb_bool_t = inthb_bool_t = int;
struct (struct) font_libraries_harfbuzz_shape_features.hb_glyph_info_thb_glyph_info_t
{
(alias) font_libraries_harfbuzz_shape_features.hb_codepoint_t = uinthb_codepoint_t (field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.codepointcodepoint; // glyph id after shaping
uint (field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.maskmask;
uint (field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.clustercluster; // index into the input (UTF-8 byte offset here)
uint (field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.var1var1, (field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.var2var2; // hb_var_int_t, private
}
struct (struct) font_libraries_harfbuzz_shape_features.hb_glyph_position_thb_glyph_position_t
{
(alias) font_libraries_harfbuzz_shape_features.hb_position_t = inthb_position_t (field) int font_libraries_harfbuzz_shape_features.hb_glyph_position_t.x_advancex_advance, (field) int font_libraries_harfbuzz_shape_features.hb_glyph_position_t.y_advancey_advance, (field) int font_libraries_harfbuzz_shape_features.hb_glyph_position_t.x_offsetx_offset, (field) int font_libraries_harfbuzz_shape_features.hb_glyph_position_t.y_offsety_offset;
uint (field) uint font_libraries_harfbuzz_shape_features.hb_glyph_position_t.varvar; // private
}
struct (struct) font_libraries_harfbuzz_shape_features.hb_feature_thb_feature_t
{
(alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t (field) uint font_libraries_harfbuzz_shape_features.hb_feature_t.tagtag;
uint (field) uint font_libraries_harfbuzz_shape_features.hb_feature_t.valuevalue;
uint (field) uint font_libraries_harfbuzz_shape_features.hb_feature_t.startstart, (field) uint font_libraries_harfbuzz_shape_features.hb_feature_t.endend;
}
struct (struct) font_libraries_harfbuzz_shape_features.hb_variation_thb_variation_t
{
(alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t (field) uint font_libraries_harfbuzz_shape_features.hb_variation_t.tagtag;
float (field) float font_libraries_harfbuzz_shape_features.hb_variation_t.valuevalue;
}
struct (struct) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_thb_ot_var_axis_info_t
{
uint (field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.axis_indexaxis_index;
(alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t (field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.tagtag;
uint (field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.name_idname_id;
uint (field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.flagsflags;
float (field) float font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.min_valuemin_value, (field) float font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.default_valuedefault_value, (field) float font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.max_valuemax_value;
uint (field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.reservedreserved;
}
(struct) font_libraries_harfbuzz_shape_features.hb_blob_thb_blob_t* font_libraries_harfbuzz_shape_features.hb_blob_t* font_libraries_harfbuzz_shape_features.hb_blob_create_from_file(const(char)* file_name) nothrow @nogchb_blob_create_from_file(const(char)* (parameter) const(char)* file_namefile_name);
void void font_libraries_harfbuzz_shape_features.hb_blob_destroy(font_libraries_harfbuzz_shape_features.hb_blob_t*) nothrow @nogchb_blob_destroy((struct) font_libraries_harfbuzz_shape_features.hb_blob_thb_blob_t*);
uint uint font_libraries_harfbuzz_shape_features.hb_blob_get_length(font_libraries_harfbuzz_shape_features.hb_blob_t*) nothrow @nogchb_blob_get_length((struct) font_libraries_harfbuzz_shape_features.hb_blob_thb_blob_t*);
(struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t* font_libraries_harfbuzz_shape_features.hb_face_t* font_libraries_harfbuzz_shape_features.hb_face_create(font_libraries_harfbuzz_shape_features.hb_blob_t*, uint index) nothrow @nogchb_face_create((struct) font_libraries_harfbuzz_shape_features.hb_blob_thb_blob_t*, uint (parameter) uint indexindex);
void void font_libraries_harfbuzz_shape_features.hb_face_destroy(font_libraries_harfbuzz_shape_features.hb_face_t*) nothrow @nogchb_face_destroy((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t*);
uint uint font_libraries_harfbuzz_shape_features.hb_face_get_upem(const(font_libraries_harfbuzz_shape_features.hb_face_t)*) nothrow @nogchb_face_get_upem(const((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t)*);
uint uint font_libraries_harfbuzz_shape_features.hb_face_get_glyph_count(const(font_libraries_harfbuzz_shape_features.hb_face_t)*) nothrow @nogchb_face_get_glyph_count(const((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t)*);
(struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t* font_libraries_harfbuzz_shape_features.hb_font_t* font_libraries_harfbuzz_shape_features.hb_font_create(font_libraries_harfbuzz_shape_features.hb_face_t*) nothrow @nogchb_font_create((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t*);
void void font_libraries_harfbuzz_shape_features.hb_font_destroy(font_libraries_harfbuzz_shape_features.hb_font_t*) nothrow @nogchb_font_destroy((struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t*);
void void font_libraries_harfbuzz_shape_features.hb_ot_font_set_funcs(font_libraries_harfbuzz_shape_features.hb_font_t*) nothrow @nogchb_ot_font_set_funcs((struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t*);
void void font_libraries_harfbuzz_shape_features.hb_font_set_scale(font_libraries_harfbuzz_shape_features.hb_font_t*, int x_scale, int y_scale) nothrow @nogchb_font_set_scale((struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t*, int (parameter) int x_scalex_scale, int (parameter) int y_scaley_scale);
void void font_libraries_harfbuzz_shape_features.hb_font_set_variations(font_libraries_harfbuzz_shape_features.hb_font_t*, const(font_libraries_harfbuzz_shape_features.hb_variation_t)*, uint count) nothrow @nogchb_font_set_variations((struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t*, const((struct) font_libraries_harfbuzz_shape_features.hb_variation_thb_variation_t)*, uint (parameter) uint countcount);
(alias) font_libraries_harfbuzz_shape_features.hb_bool_t = inthb_bool_t int font_libraries_harfbuzz_shape_features.hb_font_get_glyph_name(font_libraries_harfbuzz_shape_features.hb_font_t*, uint glyph, char* name, uint size) nothrow @nogchb_font_get_glyph_name((struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t*, (alias) font_libraries_harfbuzz_shape_features.hb_codepoint_t = uinthb_codepoint_t (parameter) uint glyphglyph, char* (parameter) char* namename, uint (parameter) uint sizesize);
(struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t* font_libraries_harfbuzz_shape_features.hb_buffer_t* font_libraries_harfbuzz_shape_features.hb_buffer_create() nothrow @nogchb_buffer_create();
void void font_libraries_harfbuzz_shape_features.hb_buffer_destroy(font_libraries_harfbuzz_shape_features.hb_buffer_t*) nothrow @nogchb_buffer_destroy((struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t*);
void void font_libraries_harfbuzz_shape_features.hb_buffer_add_utf8(font_libraries_harfbuzz_shape_features.hb_buffer_t*, const(char)* text, int text_length, uint item_offset, int item_length) nothrow @nogchb_buffer_add_utf8((struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t*, const(char)* (parameter) const(char)* texttext, int (parameter) int text_lengthtext_length,
uint (parameter) uint item_offsetitem_offset, int (parameter) int item_lengthitem_length);
void void font_libraries_harfbuzz_shape_features.hb_buffer_guess_segment_properties(font_libraries_harfbuzz_shape_features.hb_buffer_t*) nothrow @nogchb_buffer_guess_segment_properties((struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t*);
uint uint font_libraries_harfbuzz_shape_features.hb_buffer_get_length(const(font_libraries_harfbuzz_shape_features.hb_buffer_t)*) nothrow @nogchb_buffer_get_length(const((struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t)*);
(struct) font_libraries_harfbuzz_shape_features.hb_glyph_info_thb_glyph_info_t* font_libraries_harfbuzz_shape_features.hb_glyph_info_t* font_libraries_harfbuzz_shape_features.hb_buffer_get_glyph_infos(font_libraries_harfbuzz_shape_features.hb_buffer_t*, uint* length) nothrow @nogchb_buffer_get_glyph_infos((struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t*, uint* (parameter) uint* lengthlength);
(struct) font_libraries_harfbuzz_shape_features.hb_glyph_position_thb_glyph_position_t* font_libraries_harfbuzz_shape_features.hb_glyph_position_t* font_libraries_harfbuzz_shape_features.hb_buffer_get_glyph_positions(font_libraries_harfbuzz_shape_features.hb_buffer_t*, uint* length) nothrow @nogchb_buffer_get_glyph_positions((struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t*, uint* (parameter) uint* lengthlength);
void void font_libraries_harfbuzz_shape_features.hb_shape(font_libraries_harfbuzz_shape_features.hb_font_t*, font_libraries_harfbuzz_shape_features.hb_buffer_t*, const(font_libraries_harfbuzz_shape_features.hb_feature_t)* features, uint num_features) nothrow @nogchb_shape((struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t*, (struct) font_libraries_harfbuzz_shape_features.hb_buffer_thb_buffer_t*, const((struct) font_libraries_harfbuzz_shape_features.hb_feature_thb_feature_t)* (parameter) const(font_libraries_harfbuzz_shape_features.hb_feature_t)* featuresfeatures, uint (parameter) uint num_featuresnum_features);
uint uint font_libraries_harfbuzz_shape_features.hb_ot_layout_table_get_feature_tags(font_libraries_harfbuzz_shape_features.hb_face_t*, uint table_tag, uint start_offset, uint* feature_count, uint* feature_tags) nothrow @nogchb_ot_layout_table_get_feature_tags((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t*, (alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t (parameter) uint table_tagtable_tag,
uint (parameter) uint start_offsetstart_offset, uint* (parameter) uint* feature_countfeature_count, (alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t* (parameter) uint* feature_tagsfeature_tags);
uint uint font_libraries_harfbuzz_shape_features.hb_ot_var_get_axis_count(font_libraries_harfbuzz_shape_features.hb_face_t*) nothrow @nogchb_ot_var_get_axis_count((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t*);
uint uint font_libraries_harfbuzz_shape_features.hb_ot_var_get_axis_infos(font_libraries_harfbuzz_shape_features.hb_face_t*, uint start_offset, uint* axes_count, font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t* axes_array) nothrow @nogchb_ot_var_get_axis_infos((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t*, uint (parameter) uint start_offsetstart_offset, uint* (parameter) uint* axes_countaxes_count,
(struct) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_thb_ot_var_axis_info_t* (parameter) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t* axes_arrayaxes_array);
} // extern (C)
/// `HB_TAG('c','a','l','t')` as a D function: big-endian packed ASCII.
(alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t uint font_libraries_harfbuzz_shape_features.tag(string s) pure nothrow @nogc @safeHB_TAG('c','a','l','t') as a D function: big-endian packed ASCII.
tag((alias) object.string = stringstring (parameter) string ss) @safe pure nothrow @nogc
in ((parameter) string ss.(field) ulong string.lengthlength == 4)
=> (uint((parameter) string ss[0]) << 24) | (uint((parameter) string ss[1]) << 16) | (uint((parameter) string ss[2]) << 8) | uint((parameter) string ss[3]);
/// The inverse, by value: four characters, no allocation.
char[4] char[4] font_libraries_harfbuzz_shape_features.tagName(uint t) pure nothrow @nogc @safeThe inverse, by value: four characters, no allocation.
tagName((alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t (parameter) uint tt) @safe pure nothrow @nogc
=> [cast(char)((parameter) uint tt >> 24), cast(char)((parameter) uint tt >> 16), cast(char)((parameter) uint tt >> 8), cast(char) (parameter) uint tt];
(alias) object.string = stringstring string font_libraries_harfbuzz_shape_features.resolveFont(string[] args) @saferesolveFont((alias) object.string = stringstring[] (parameter) string[] argsargs) @safe
{
if ((parameter) string[] argsargs.(field) ulong string[].lengthlength > 1 && bool std.file.exists!string(string name) nothrow @nogc @safeDetermine whether the given file (or directory) exists.
exists((parameter) string[] argsargs[1]))
return (parameter) string[] argsargs[1];
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;
}
void void font_libraries_harfbuzz_shape_features.listFeatures(font_libraries_harfbuzz_shape_features.hb_face_t* face, string table) @trustedlistFeatures((struct) font_libraries_harfbuzz_shape_features.hb_face_thb_face_t* (parameter) font_libraries_harfbuzz_shape_features.hb_face_t* faceface, (alias) object.string = stringstring (parameter) string tabletable) @trusted
{
(alias) font_libraries_harfbuzz_shape_features.hb_tag_t = uinthb_tag_t[64] (local variable) uint[64] tagstags;
uint (local variable) uint countcount = (local variable) uint[64] tagstags.(constant) ulong uint[64].length = 64LUlength;
uint font_libraries_harfbuzz_shape_features.hb_ot_layout_table_get_feature_tags(font_libraries_harfbuzz_shape_features.hb_face_t*, uint table_tag, uint start_offset, uint* feature_count, uint* feature_tags) nothrow @nogchb_ot_layout_table_get_feature_tags((parameter) font_libraries_harfbuzz_shape_features.hb_face_t* faceface, uint font_libraries_harfbuzz_shape_features.tag(string s) pure nothrow @nogc @safeHB_TAG('c','a','l','t') as a D function: big-endian packed ASCII.
tag((parameter) string tabletable), 0, &(local variable) uint countcount, (local variable) uint[64] tagstags.(constant) uint* uint[64].ptr = &tagsptr);
(alias) object.string = stringstring (local variable) string lineline;
foreach ((parameter) uint tt; (local variable) uint[64] tagstags[0 .. (local variable) uint countcount])
(local variable) string lineline ~= char[4] font_libraries_harfbuzz_shape_features.tagName(uint t) pure nothrow @nogc @safeThe inverse, by value: four characters, no allocation.
tagName((local variable) uint tt)[] ~ " ";
void std.stdio.writefln!(char, string, uint, string)(in char[] fmt, string __param_1, uint __param_2, string __param_3) @safeEquivalent to writef(fmt, args, '\n').
writefln("%s features (%d): %s", (parameter) string tabletable, (local variable) uint countcount, (local variable) string lineline);
}
void void font_libraries_harfbuzz_shape_features.shape(font_libraries_harfbuzz_shape_features.hb_font_t* font, string text, const(font_libraries_harfbuzz_shape_features.hb_feature_t)[] features, string label) @trustedshape((struct) font_libraries_harfbuzz_shape_features.hb_font_thb_font_t* (parameter) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont, (alias) object.string = stringstring (parameter) string texttext, const((struct) font_libraries_harfbuzz_shape_features.hb_feature_thb_feature_t)[] (parameter) const(font_libraries_harfbuzz_shape_features.hb_feature_t)[] featuresfeatures, (alias) object.string = stringstring (parameter) string labellabel) @trusted
{
auto (local variable) font_libraries_harfbuzz_shape_features.hb_buffer_t* bufbuf = font_libraries_harfbuzz_shape_features.hb_buffer_t* font_libraries_harfbuzz_shape_features.hb_buffer_create() nothrow @nogchb_buffer_create();
scope (exit) void font_libraries_harfbuzz_shape_features.hb_buffer_destroy(font_libraries_harfbuzz_shape_features.hb_buffer_t*) nothrow @nogchb_buffer_destroy((local variable) font_libraries_harfbuzz_shape_features.hb_buffer_t* bufbuf);
void font_libraries_harfbuzz_shape_features.hb_buffer_add_utf8(font_libraries_harfbuzz_shape_features.hb_buffer_t*, const(char)* text, int text_length, uint item_offset, int item_length) nothrow @nogchb_buffer_add_utf8((local variable) font_libraries_harfbuzz_shape_features.hb_buffer_t* bufbuf, (parameter) string texttext.(field) immutable(char)* string.ptrptr, cast(int) (parameter) string texttext.(field) ulong string.lengthlength, 0, cast(int) (parameter) string texttext.(field) ulong string.lengthlength);
void font_libraries_harfbuzz_shape_features.hb_buffer_guess_segment_properties(font_libraries_harfbuzz_shape_features.hb_buffer_t*) nothrow @nogchb_buffer_guess_segment_properties((local variable) font_libraries_harfbuzz_shape_features.hb_buffer_t* bufbuf);
void font_libraries_harfbuzz_shape_features.hb_shape(font_libraries_harfbuzz_shape_features.hb_font_t*, font_libraries_harfbuzz_shape_features.hb_buffer_t*, const(font_libraries_harfbuzz_shape_features.hb_feature_t)* features, uint num_features) nothrow @nogchb_shape((parameter) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont, (local variable) font_libraries_harfbuzz_shape_features.hb_buffer_t* bufbuf, (parameter) const(font_libraries_harfbuzz_shape_features.hb_feature_t)[] featuresfeatures.(field) const(font_libraries_harfbuzz_shape_features.hb_feature_t)* const(font_libraries_harfbuzz_shape_features.hb_feature_t)[].ptrptr, cast(uint) (parameter) const(font_libraries_harfbuzz_shape_features.hb_feature_t)[] featuresfeatures.(field) ulong const(font_libraries_harfbuzz_shape_features.hb_feature_t)[].lengthlength);
uint (local variable) uint nn;
auto (local variable) font_libraries_harfbuzz_shape_features.hb_glyph_info_t* infosinfos = font_libraries_harfbuzz_shape_features.hb_glyph_info_t* font_libraries_harfbuzz_shape_features.hb_buffer_get_glyph_infos(font_libraries_harfbuzz_shape_features.hb_buffer_t*, uint* length) nothrow @nogchb_buffer_get_glyph_infos((local variable) font_libraries_harfbuzz_shape_features.hb_buffer_t* bufbuf, &(local variable) uint nn);
auto (local variable) font_libraries_harfbuzz_shape_features.hb_glyph_position_t* pospos = font_libraries_harfbuzz_shape_features.hb_glyph_position_t* font_libraries_harfbuzz_shape_features.hb_buffer_get_glyph_positions(font_libraries_harfbuzz_shape_features.hb_buffer_t*, uint* length) nothrow @nogchb_buffer_get_glyph_positions((local variable) font_libraries_harfbuzz_shape_features.hb_buffer_t* bufbuf, &(local variable) uint nn);
void std.stdio.writefln!(char, string, uint)(in char[] fmt, string __param_1, uint __param_2) @safeEquivalent to writef(fmt, args, '\n').
writefln(" %-14s %d glyphs:", (parameter) string labellabel, (local variable) uint nn);
foreach ((local variable) uint ii; 0 .. (local variable) uint nn)
{
char[64] (local variable) char[64] namename;
if (!int font_libraries_harfbuzz_shape_features.hb_font_get_glyph_name(font_libraries_harfbuzz_shape_features.hb_font_t*, uint glyph, char* name, uint size) nothrow @nogchb_font_get_glyph_name((parameter) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont, (local variable) font_libraries_harfbuzz_shape_features.hb_glyph_info_t* infosinfos[(local variable) uint ii].(field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.codepointcodepoint, (local variable) char[64] namename.(constant) char* char[64].ptr = &nameptr, (local variable) char[64] namename.(constant) ulong char[64].length = 64LUlength))
(local variable) char[64] namename[0] = 0;
void std.stdio.writefln!(char, uint, uint, int, char[])(in char[] fmt, uint __param_1, uint __param_2, int __param_3, char[] __param_4) @safeEquivalent to writef(fmt, args, '\n').
writefln(" gid %5d cluster %2d adv %5d %s", (local variable) font_libraries_harfbuzz_shape_features.hb_glyph_info_t* infosinfos[(local variable) uint ii].(field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.codepointcodepoint,
(local variable) font_libraries_harfbuzz_shape_features.hb_glyph_info_t* infosinfos[(local variable) uint ii].(field) uint font_libraries_harfbuzz_shape_features.hb_glyph_info_t.clustercluster, (local variable) font_libraries_harfbuzz_shape_features.hb_glyph_position_t* pospos[(local variable) uint ii].(field) int font_libraries_harfbuzz_shape_features.hb_glyph_position_t.x_advancex_advance, inout(char)[] std.string.fromStringz!char(return scope inout(char)* cString) pure nothrow @nogc @systemfromStringz((local variable) char[64] namename.(constant) char* char[64].ptr = &nameptr));
}
}
int int D main(string[] args)main((alias) object.string = stringstring[] (parameter) string[] argsargs)
{
const (local variable) const(string) pathpath = string font_libraries_harfbuzz_shape_features.resolveFont(string[] args) @saferesolveFont((parameter) string[] argsargs);
if ((local variable) const(string) pathpath is null)
{
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 a path, or install fontconfig)");
return 0;
}
auto (local variable) font_libraries_harfbuzz_shape_features.hb_blob_t* blobblob = font_libraries_harfbuzz_shape_features.hb_blob_t* font_libraries_harfbuzz_shape_features.hb_blob_create_from_file(const(char)* file_name) nothrow @nogchb_blob_create_from_file((local variable) const(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_harfbuzz_shape_features.hb_blob_destroy(font_libraries_harfbuzz_shape_features.hb_blob_t*) nothrow @nogchb_blob_destroy((local variable) font_libraries_harfbuzz_shape_features.hb_blob_t* blobblob);
if (uint font_libraries_harfbuzz_shape_features.hb_blob_get_length(font_libraries_harfbuzz_shape_features.hb_blob_t*) nothrow @nogchb_blob_get_length((local variable) font_libraries_harfbuzz_shape_features.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 ", (local variable) const(string) pathpath);
return 0;
}
auto (local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface = font_libraries_harfbuzz_shape_features.hb_face_t* font_libraries_harfbuzz_shape_features.hb_face_create(font_libraries_harfbuzz_shape_features.hb_blob_t*, uint index) nothrow @nogchb_face_create((local variable) font_libraries_harfbuzz_shape_features.hb_blob_t* blobblob, 0);
scope (exit) void font_libraries_harfbuzz_shape_features.hb_face_destroy(font_libraries_harfbuzz_shape_features.hb_face_t*) nothrow @nogchb_face_destroy((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface);
const (local variable) const(uint) upemupem = uint font_libraries_harfbuzz_shape_features.hb_face_get_upem(const(font_libraries_harfbuzz_shape_features.hb_face_t)*) nothrow @nogchb_face_get_upem((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface);
void std.stdio.writefln!(char, string)(in char[] fmt, string __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln("font: %s", (local variable) const(string) pathpath);
void std.stdio.writefln!(char, const(uint), uint, uint)(in char[] fmt, const(uint) __param_1, uint __param_2, uint __param_3) @safeEquivalent to writef(fmt, args, '\n').
writefln("upem %d, %d glyphs, %d variation axes", (local variable) const(uint) upemupem,
uint font_libraries_harfbuzz_shape_features.hb_face_get_glyph_count(const(font_libraries_harfbuzz_shape_features.hb_face_t)*) nothrow @nogchb_face_get_glyph_count((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface), uint font_libraries_harfbuzz_shape_features.hb_ot_var_get_axis_count(font_libraries_harfbuzz_shape_features.hb_face_t*) nothrow @nogchb_ot_var_get_axis_count((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface));
// (2) inspector inventory
void font_libraries_harfbuzz_shape_features.listFeatures(font_libraries_harfbuzz_shape_features.hb_face_t* face, string table) @trustedlistFeatures((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface, "GSUB");
void font_libraries_harfbuzz_shape_features.listFeatures(font_libraries_harfbuzz_shape_features.hb_face_t* face, string table) @trustedlistFeatures((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface, "GPOS");
// (3) axes, and a variation set before shaping
(struct) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_thb_ot_var_axis_info_t[16] (local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t[16] axesaxes;
uint (local variable) uint axisCountaxisCount = (local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t[16] axesaxes.(constant) ulong font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t[16].length = 16LUlength;
uint font_libraries_harfbuzz_shape_features.hb_ot_var_get_axis_infos(font_libraries_harfbuzz_shape_features.hb_face_t*, uint start_offset, uint* axes_count, font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t* axes_array) nothrow @nogchb_ot_var_get_axis_infos((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface, 0, &(local variable) uint axisCountaxisCount, (local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t[16] axesaxes.(constant) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t* font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t[16].ptr = &axesptr);
(struct) font_libraries_harfbuzz_shape_features.hb_variation_thb_variation_t[1] (local variable) font_libraries_harfbuzz_shape_features.hb_variation_t[1] variationsvariations;
foreach ((parameter) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa; (local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t[16] axesaxes[0 .. (local variable) uint axisCountaxisCount])
{
void std.stdio.writefln!(char, char[], float, float, float)(in char[] fmt, char[] __param_1, float __param_2, float __param_3, float __param_4) @safeEquivalent to writef(fmt, args, '\n').
writefln("axis %s min %g default %g max %g", char[4] font_libraries_harfbuzz_shape_features.tagName(uint t) pure nothrow @nogc @safeThe inverse, by value: four characters, no allocation.
tagName((local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa.(field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.tagtag)[],
(local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa.(field) float font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.min_valuemin_value, (local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa.(field) float font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.default_valuedefault_value, (local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa.(field) float font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.max_valuemax_value);
if ((local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa.(field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.tagtag == uint font_libraries_harfbuzz_shape_features.tag(string s) pure nothrow @nogc @safeHB_TAG('c','a','l','t') as a D function: big-endian packed ASCII.
tag("wght"))
(local variable) font_libraries_harfbuzz_shape_features.hb_variation_t[1] variationsvariations[0] = (struct) font_libraries_harfbuzz_shape_features.hb_variation_thb_variation_t((local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa.(field) uint font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.tagtag, (local variable) font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t aa.(field) float font_libraries_harfbuzz_shape_features.hb_ot_var_axis_info_t.max_valuemax_value);
}
auto (local variable) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont = font_libraries_harfbuzz_shape_features.hb_font_t* font_libraries_harfbuzz_shape_features.hb_font_create(font_libraries_harfbuzz_shape_features.hb_face_t*) nothrow @nogchb_font_create((local variable) font_libraries_harfbuzz_shape_features.hb_face_t* faceface);
scope (exit) void font_libraries_harfbuzz_shape_features.hb_font_destroy(font_libraries_harfbuzz_shape_features.hb_font_t*) nothrow @nogchb_font_destroy((local variable) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont);
void font_libraries_harfbuzz_shape_features.hb_ot_font_set_funcs(font_libraries_harfbuzz_shape_features.hb_font_t*) nothrow @nogchb_ot_font_set_funcs((local variable) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont); // HarfBuzz's own OpenType font functions; no FreeType
void font_libraries_harfbuzz_shape_features.hb_font_set_scale(font_libraries_harfbuzz_shape_features.hb_font_t*, int x_scale, int y_scale) nothrow @nogchb_font_set_scale((local variable) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont, (local variable) const(uint) upemupem, (local variable) const(uint) upemupem); // advances in design units
if ((local variable) font_libraries_harfbuzz_shape_features.hb_variation_t[1] variationsvariations[0].(field) uint font_libraries_harfbuzz_shape_features.hb_variation_t.tagtag != 0)
{
void font_libraries_harfbuzz_shape_features.hb_font_set_variations(font_libraries_harfbuzz_shape_features.hb_font_t*, const(font_libraries_harfbuzz_shape_features.hb_variation_t)*, uint count) nothrow @nogchb_font_set_variations((local variable) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont, (local variable) font_libraries_harfbuzz_shape_features.hb_variation_t[1] variationsvariations.(constant) font_libraries_harfbuzz_shape_features.hb_variation_t* font_libraries_harfbuzz_shape_features.hb_variation_t[1].ptr = &variationsptr, 1);
void std.stdio.writefln!(char, char[], float)(in char[] fmt, char[] __param_1, float __param_2) @safeEquivalent to writef(fmt, args, '\n').
writefln("variation set: %s = %g", char[4] font_libraries_harfbuzz_shape_features.tagName(uint t) pure nothrow @nogc @safeThe inverse, by value: four characters, no allocation.
tagName((local variable) font_libraries_harfbuzz_shape_features.hb_variation_t[1] variationsvariations[0].(field) uint font_libraries_harfbuzz_shape_features.hb_variation_t.tagtag)[], (local variable) font_libraries_harfbuzz_shape_features.hb_variation_t[1] variationsvariations[0].(field) float font_libraries_harfbuzz_shape_features.hb_variation_t.valuevalue);
}
// (4) the same text, contextual ligatures on and off
const (local variable) const(string) texttext = "a -> b != c ffi";
const (local variable) const(font_libraries_harfbuzz_shape_features.hb_feature_t[]) onon = [(struct) font_libraries_harfbuzz_shape_features.hb_feature_thb_feature_t(uint font_libraries_harfbuzz_shape_features.tag(string s) pure nothrow @nogc @safeHB_TAG('c','a','l','t') as a D function: big-endian packed ASCII.
tag("calt"), 1, 0, uint.(constant) uint uint.max = 4294967295umax), (struct) font_libraries_harfbuzz_shape_features.hb_feature_thb_feature_t(uint font_libraries_harfbuzz_shape_features.tag(string s) pure nothrow @nogc @safeHB_TAG('c','a','l','t') as a D function: big-endian packed ASCII.
tag("liga"), 1, 0, uint.(constant) uint uint.max = 4294967295umax)];
const (local variable) const(font_libraries_harfbuzz_shape_features.hb_feature_t[]) offoff = [(struct) font_libraries_harfbuzz_shape_features.hb_feature_thb_feature_t(uint font_libraries_harfbuzz_shape_features.tag(string s) pure nothrow @nogc @safeHB_TAG('c','a','l','t') as a D function: big-endian packed ASCII.
tag("calt"), 0, 0, uint.(constant) uint uint.max = 4294967295umax), (struct) font_libraries_harfbuzz_shape_features.hb_feature_thb_feature_t(uint font_libraries_harfbuzz_shape_features.tag(string s) pure nothrow @nogc @safeHB_TAG('c','a','l','t') as a D function: big-endian packed ASCII.
tag("liga"), 0, 0, uint.(constant) uint uint.max = 4294967295umax)];
void std.stdio.writefln!(char, const(string)[])(in char[] fmt, const(string)[] __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln("shaping %(%s%):", [(local variable) const(string) texttext]);
void font_libraries_harfbuzz_shape_features.shape(font_libraries_harfbuzz_shape_features.hb_font_t* font, string text, const(font_libraries_harfbuzz_shape_features.hb_feature_t)[] features, string label) @trustedshape((local variable) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont, (local variable) const(string) texttext, (local variable) const(font_libraries_harfbuzz_shape_features.hb_feature_t[]) onon, "calt+liga on");
void font_libraries_harfbuzz_shape_features.shape(font_libraries_harfbuzz_shape_features.hb_font_t* font, string text, const(font_libraries_harfbuzz_shape_features.hb_feature_t)[] features, string label) @trustedshape((local variable) font_libraries_harfbuzz_shape_features.hb_font_t* fontfont, (local variable) const(string) texttext, (local variable) const(font_libraries_harfbuzz_shape_features.hb_feature_t[]) offoff, "calt+liga off");
return 0;
}