Skip to content

split_postscript

Splits a PostScript font name into family and style at its first hyphen: NeutrifPro-SemiBold is NeutrifPro and SemiBold.

use helpers4::font::split_postscript;

Cargo feature font (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features font

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.11", default-features = false, features = ["font"] }
pub fn split_postscript(name: &str) -> (&str, &str)
ParameterTypeDescription
name&strThe PostScript name.

(&str, &str) — The family and the style, borrowed from name. The style is empty when there is no hyphen.

use helpers4::font::split_postscript;

assert_eq!(split_postscript("NeutrifPro-SemiBold"), ("NeutrifPro", "SemiBold"));
assert_eq!(split_postscript("Helvetica"), ("Helvetica", ""));

src/font/split_postscript.rs