blob: 8134ebd6918ef0475d577192464c30b73ed53f33 [file] [log] [blame]
# Copyright 2016 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/package.gni")
import("//build/rust/rustc_binary.gni")
rustc_binary("font_server") {
name = "font_server"
with_unit_tests = true
edition = "2018"
deps = [
"//garnet/public/fidl/fuchsia.fonts:fuchsia.fonts-rustc",
"//garnet/public/lib/fidl/rust/fidl",
"//garnet/public/rust/fdio",
"//garnet/public/rust/fuchsia-app",
"//garnet/public/rust/fuchsia-async",
"//garnet/public/rust/fuchsia-zircon",
"//third_party/rust-crates/rustc_deps:failure",
"//third_party/rust-crates/rustc_deps:futures-preview",
"//third_party/rust-crates/rustc_deps:getopts",
"//third_party/rust-crates/rustc_deps:libc",
"//third_party/rust-crates/rustc_deps:log",
"//third_party/rust-crates/rustc_deps:serde",
"//third_party/rust-crates/rustc_deps:serde_derive",
"//third_party/rust-crates/rustc_deps:serde_json",
"//third_party/rust-crates/rustc_deps:unicase",
"//zircon/public/fidl/fuchsia-mem:fuchsia-mem-rustc",
]
non_rust_deps = [ "//third_party/freetype2" ]
}
package("fonts") {
deps = [
":font_server",
]
binary = "font_server"
meta = [
{
path = rebase_path("meta/fonts.cmx")
dest = "fonts.cmx"
},
]
resources = [
{
path = rebase_path("manifest.json")
dest = "manifest.json"
},
]
fonts = [
"material/MaterialIcons-Regular.ttf",
"roboto/Roboto-BlackItalic.ttf",
"roboto/Roboto-Black.ttf",
"roboto/Roboto-BoldItalic.ttf",
"roboto/Roboto-Bold.ttf",
"roboto/Roboto-Italic.ttf",
"roboto/Roboto-LightItalic.ttf",
"roboto/Roboto-Light.ttf",
"roboto/Roboto-MediumItalic.ttf",
"roboto/Roboto-Medium.ttf",
"roboto/Roboto-Regular.ttf",
"roboto/Roboto-ThinItalic.ttf",
"roboto/Roboto-Thin.ttf",
"robotocondensed/RobotoCondensed-BoldItalic.ttf",
"robotocondensed/RobotoCondensed-Bold.ttf",
"robotocondensed/RobotoCondensed-Italic.ttf",
"robotocondensed/RobotoCondensed-LightItalic.ttf",
"robotocondensed/RobotoCondensed-Light.ttf",
"robotocondensed/RobotoCondensed-Regular.ttf",
"robotomono/RobotoMono-BoldItalic.ttf",
"robotomono/RobotoMono-Bold.ttf",
"robotomono/RobotoMono-Italic.ttf",
"robotomono/RobotoMono-LightItalic.ttf",
"robotomono/RobotoMono-Light.ttf",
"robotomono/RobotoMono-MediumItalic.ttf",
"robotomono/RobotoMono-Medium.ttf",
"robotomono/RobotoMono-Regular.ttf",
"robotomono/RobotoMono-ThinItalic.ttf",
"robotomono/RobotoMono-Thin.ttf",
"robotoslab/RobotoSlab-Bold.ttf",
"robotoslab/RobotoSlab-Light.ttf",
"robotoslab/RobotoSlab-Regular.ttf",
"robotoslab/RobotoSlab-Thin.ttf",
]
foreach(font, fonts) {
resources += [
{
path = rebase_path("third_party/${font}")
file_name = get_path_info(font, "file")
dest = "fonts/${file_name}"
},
]
}
}
# TODO(sergeyu): Once PKG-47 is fixed it will be possible to separate fonts
# packages from font_server.
package("fonts_minimal") {
deprecated_bare_package_url = "//build"
deps = [
":font_server",
]
binary = "font_server"
meta = [
{
path = rebase_path("meta/fonts.cmx")
dest = "fonts.cmx"
},
]
resources = [
{
path = rebase_path("manifest_minimal.json")
dest = "manifest.json"
},
]
fonts = [
"material/MaterialIcons-Regular.ttf",
"roboto/Roboto-Light.ttf",
"roboto/Roboto-Medium.ttf",
"roboto/Roboto-Regular.ttf",
]
foreach(font, fonts) {
resources += [
{
path = rebase_path("third_party/${font}")
file_name = get_path_info(font, "file")
dest = "fonts/${file_name}"
},
]
}
}
rustc_binary("font_provider_test") {
testonly = true
edition = "2018"
deps = [
"//garnet/public/fidl/fuchsia.fonts:fuchsia.fonts-rustc",
"//garnet/public/lib/fidl/rust/fidl",
"//garnet/public/rust/fdio",
"//garnet/public/rust/fuchsia-app",
"//garnet/public/rust/fuchsia-async",
"//garnet/public/rust/fuchsia-zircon",
"//third_party/rust-crates/rustc_deps:failure",
"//third_party/rust-crates/rustc_deps:futures-preview",
]
source_root = "tests/font_provider_test.rs"
}
package("font_provider_tests") {
testonly = true
# Necessary to work around ZX-2727.
deprecated_system_image = true
deps = [
":font_provider_test",
":font_server",
]
tests = [
{
name = "font_provider_test"
},
{
name = "font_server_bin_test"
},
]
resources = [
{
path = rebase_path("tests/test_manifest.json")
dest = "testdata/test_fonts/manifest.json"
},
]
# TODO(sergeyu): Noto CJK fonts are not included in the default fonts package
# due to their size. Currently they are used only for tests. Once PKG-47 is
# implemented it will be possible to customize set of fonts on higher levels,
# which will allow to include these fonts in the default font package.
fonts = [
"noto-cjk/NotoSansCJK-Regular.ttc",
"noto-cjk/NotoSerifCJK-Regular.ttc",
]
foreach(font, fonts) {
resources += [
{
path = rebase_path("third_party/${font}")
file_name = get_path_info(font, "file")
dest = "testdata/test_fonts/${file_name}"
},
]
}
}