Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
run: |
"${GITHUB_WORKSPACE}/bin/bazel" test -c opt ... --test_output=all

- name: Test (Default Build, No Dep Graph)
run: |
"${GITHUB_WORKSPACE}/bin/bazel" test --//:harfbuzz_dep_graph=False ... --test_output=all

check_tests_osx:
name: Check Tests (Mac OS)
runs-on: macos-latest
Expand Down
15 changes: 15 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

bool_flag(
name = "harfbuzz_dep_graph",
build_setting_default = True,
visibility = ["//visibility:public"],
)

config_setting(
name = "use_harfbuzz_dep_graph",
flag_values = {
":harfbuzz_dep_graph": "True",
},
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_rust", version = "0.68.1")
bazel_dep(name = "glib", version = "2.82.2.bcr.7")
bazel_dep(name = "brotli", version = "1.2.0")
bazel_dep(name = "bazel_skylib", version = "1.9.0")

# Frequency Data
bazel_dep(name = "ift_encoder_data", version = "git")
Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ This code repository contains an implementation of an

## Status

This implementation is still in the early stages and as at the moment is work in progress.
This implementation is still in the early stages and as at the moment is work in progress.
We aim to keep it updated and consistent with the current IFT specification working draft
found [here](https://w3c.github.io/IFT/Overview.html).

The current implementation is capable of producing a spec-compliant encoding, but does not
The current implementation is capable of producing a spec-compliant encoding, but does not
yet fully support all aspects of the specification. Notably:

* Format 1 patch maps are not generated.
Expand All @@ -33,6 +33,19 @@ and run all of the tests:
bazel test ...
```

### Building without Dependency Graph Support

By default this depends on the experimental harfbuzz dependency graph API which isn't yet in mainline harfbuzz.
The dependency graph functionality can be disabled at compile time using the `harfbuzz_dep_graph` build flag.
For example:

```sh
bazel build --//:harfbuzz_dep_graph=False ...
bazel test --//:harfbuzz_dep_graph=False ...
```

Disabling the harfbuzz dependency graph api will cause segmenter runs using the `CLOSURE_AND_DEP_GRAPH` and `CLOSURE_AND_VALIDATE_DEP_GRAPH` condition analysis modes to fail.

## Code Style

The code follows the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). Formatting is enforced by an automated check for new commits to this repo. You can auto-correct formatting for all files using the check-format.sh
Expand Down
3 changes: 0 additions & 3 deletions common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ cc_library(
"try.h",
"woff2.h",
],
copts = [
"-DHB_EXPERIMENTAL_API",
],
visibility = [
"//visibility:public",
],
Expand Down
6 changes: 0 additions & 6 deletions ift/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ cc_test(
"table_keyed_diff_test.cc",
"url_template_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
],
data = [
"//common:testdata",
"//ift:testdata",
Expand All @@ -80,9 +77,6 @@ cc_test(
srcs = [
"integration_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
],
data = [
"//common:testdata",
"//ift:testdata",
Expand Down
33 changes: 16 additions & 17 deletions ift/dep_graph/BUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")


cc_library(
name = "dep_graph",
srcs = [
"dependency_graph.h",
"dependency_graph.cc",
"node.h",
"traversal.h",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
srcs = select({
"//:use_harfbuzz_dep_graph": [
"dependency_graph.h",
"dependency_graph.cc",
"node.h",
"traversal.h",
],
"//conditions:default": [],
}),
visibility = [
"//ift/encoder:__pkg__",
],
Expand All @@ -31,13 +31,12 @@ cc_library(
cc_test(
name = "dependency_graph_test",
size = "small",
srcs = [
"dependency_graph_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
srcs = select({
"//:use_harfbuzz_dep_graph": [
"dependency_graph_test.cc",
],
"//conditions:default": [],
}),
data = [
"//common:testdata",
],
Expand Down
4 changes: 2 additions & 2 deletions ift/dep_graph/dependency_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ namespace ift::dep_graph {
class TraversalContext;

/*
* Wrapper around harfbuzz's glyph depedency graph API.
* Wrapper around harfbuzz's glyph dependency graph API.
*
* Allows exploring glyph depedencies within a font.
* Allows exploring glyph dependencies within a font.
*/
class DependencyGraph {
public:
Expand Down
4 changes: 2 additions & 2 deletions ift/dep_graph/dependency_graph_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ TEST_F(DependencyGraphTest, ImpliedFeatureEdge_Liga) {
// TODO(garretrieger):
// - basic math, CFF, and COLR tests.

// TODO(garretrieger) we currently only have a few specialized tests, relyng primarily on DepedencyClosureTest
// for coverage of DepedencyGraph functionality. We should add some basic tests here that test DepedencyGraph
// TODO(garretrieger) we currently only have a few specialized tests, relyng primarily on DependencyClosureTest
// for coverage of DependencyGraph functionality. We should add some basic tests here that test DepedencyGraph
// core features in isolation.

} // namespace ift::dep_graph
2 changes: 1 addition & 1 deletion ift/dep_graph/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace ift::dep_graph {

// A single node in a fonts glyph depedency graph.
// A single node in a fonts glyph dependency graph.
class Node {
public:
enum NodeType {
Expand Down
2 changes: 1 addition & 1 deletion ift/dep_graph/traversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace ift::dep_graph {

// A single node in a fonts glyph depedency graph.
// A single node in a fonts glyph dependency graph.
class Traversal {
public:
void SetPendingEdges() {
Expand Down
58 changes: 14 additions & 44 deletions ift/encoder/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ cc_library(
"compiler.cc",
"compiler.h",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
visibility = [
"//ift:__subpackages__",
"//ift/client:__pkg__",
Expand Down Expand Up @@ -60,7 +56,6 @@ cc_library(
"candidate_merge.h",
"complex_condition_finder.cc",
"complex_condition_finder.h",
"dependency_closure.cc",
"dependency_closure.h",
"estimated_patch_size_cache.cc",
"estimated_patch_size_cache.h",
Expand All @@ -78,11 +73,14 @@ cc_library(
"requested_segmentation_information.h",
"segmentation_context.cc",
"segmentation_context.h",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
] + select({
"//:use_harfbuzz_dep_graph": [
"dependency_closure.cc",
],
"//conditions:default": [
"dependency_closure_disabled.cc",
],
}),
visibility = [
],
deps = [
Expand Down Expand Up @@ -145,9 +143,6 @@ cc_library(
"subset_definition.h",
"types.h",
],
copts = [
"-DHB_EXPERIMENTAL_API",
],
visibility = [
"//visibility:public",
],
Expand Down Expand Up @@ -203,10 +198,6 @@ cc_test(
srcs = [
"glyph_segmentation_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
data = [
"//common:testdata",
"//ift:testdata",
Expand All @@ -225,10 +216,6 @@ cc_test(
srcs = [
"complex_condition_finder_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
data = [
"//common:testdata",
"//ift:testdata",
Expand All @@ -247,10 +234,6 @@ cc_test(
srcs = [
"closure_glyph_segmenter_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
data = [
"//common:testdata",
"//ift:testdata",
Expand All @@ -268,10 +251,6 @@ cc_test(
srcs = [
"glyph_closure_cache_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
data = [
"//common:testdata",
],
Expand All @@ -289,10 +268,6 @@ cc_test(
data = [
"//common:testdata",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
deps = [
":segmentation_context",
"//common",
Expand All @@ -307,10 +282,6 @@ cc_test(
"candidate_merge_test.cc",
"mock_patch_size_cache.h",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
data = [
"//common:testdata",
],
Expand Down Expand Up @@ -339,13 +310,12 @@ cc_test(
cc_test(
name = "dependency_closure_test",
size = "small",
srcs = [
"dependency_closure_test.cc",
],
copts = [
"-DHB_EXPERIMENTAL_API",
"-DHB_DEPEND_API",
],
srcs = select({
"//:use_harfbuzz_dep_graph": [
"dependency_closure_test.cc",
],
"//conditions:default": [],
}),
data = [
"//common:testdata",
],
Expand Down
9 changes: 8 additions & 1 deletion ift/encoder/closure_glyph_segmenter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ class ClosureGlyphSegmenterTest : public ::testing::Test {
segmenter_find_conditions(8, 8, FIND_CONDITIONS, CLOSURE_ONLY),
segmenter_move_to_init_font(8, 8, MOVE_TO_INIT_FONT, CLOSURE_ONLY),

#ifdef HB_DEPEND_API
segmenter_dep_graph(8, 8, PATCH, CLOSURE_AND_VALIDATE_DEP_GRAPH),
segmenter_find_conditions_dep_graph(8, 8, FIND_CONDITIONS, CLOSURE_AND_VALIDATE_DEP_GRAPH),
segmenter_move_to_init_font_dep_graph(8, 8, MOVE_TO_INIT_FONT, CLOSURE_AND_VALIDATE_DEP_GRAPH) {
segmenter_move_to_init_font_dep_graph(8, 8, MOVE_TO_INIT_FONT, CLOSURE_AND_VALIDATE_DEP_GRAPH)
#else
segmenter_dep_graph(8, 8, PATCH, CLOSURE_ONLY),
segmenter_find_conditions_dep_graph(8, 8, FIND_CONDITIONS, CLOSURE_ONLY),
segmenter_move_to_init_font_dep_graph(8, 8, MOVE_TO_INIT_FONT, CLOSURE_ONLY)
#endif
{
roboto = from_file("common/testdata/Roboto-Regular.ttf");
noto_nastaliq_urdu =
from_file("common/testdata/NotoNastaliqUrdu.subset.ttf");
Expand Down
2 changes: 1 addition & 1 deletion ift/encoder/dependency_closure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using ift::dep_graph::Traversal;
namespace ift::encoder {

DependencyClosure::AnalysisAccuracy DependencyClosure::TraversalAccuracy(const Traversal& traversal) const {
// TODO(garretrieger): there's several types of depedencies that we do not handle yet and as a result
// TODO(garretrieger): there's several types of dependencies that we do not handle yet and as a result
// consider inaccurate. Adding support for these will allow the dep graph to be used more widely:
// - UVS edges: more complex case is generating conjunctive conditions from them.
// - Ligatures: at least in simple non-nested cases we should be able to generate the corresponding conditions.
Expand Down
Loading
Loading