From 4c0c19d5f3089265e23b4995ad360cb9f168d6cb Mon Sep 17 00:00:00 2001 From: Janos Hrubos <33330538+janoshrubos@users.noreply.github.com> Date: Mon, 21 Dec 2020 16:46:24 +0100 Subject: [PATCH 1/3] Create 0000-ns-fonts-command.mf --- active-rfcs/0000-ns-fonts-command.md | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 active-rfcs/0000-ns-fonts-command.md diff --git a/active-rfcs/0000-ns-fonts-command.md b/active-rfcs/0000-ns-fonts-command.md new file mode 100644 index 0000000..5232db4 --- /dev/null +++ b/active-rfcs/0000-ns-fonts-command.md @@ -0,0 +1,38 @@ +- Start Date: 2020-12-21 +- Target Major Version: 8.x +- Reference Issues: +- Implementation PR: + +# Summary + +A sore spot for quite a long time is trying to get the font-family combination correct for iOS/Android. +For a custom font such as barlow-bold.ttf the css needs to be: + +``` +font-family: Barlow, barlow-bold; +``` +This feature would list all the available custom fonts with their correct form to use it in css. + +# Basic example + +Add a convenient cli command which prints out exactly what css is needed for any given font: +``` +$ ns fonts + +Found Custom Fonts: +------------------- +barlow-bold.ttf -> font-family: Barlow, barlow-bold; +fontawesome.ttf -> font-family: FontAwesome, fontawesome; +``` + +# Motivation + +Getting this correct is sometimes incredibly frustrating for custom fonts. + +This feature would save ton of time debugging why custom fonts aren't working. + +# Detailed design + +Add a new CLI command `ns fonts` that will find a `fonts` folder in all the possible locations (`/fonts`, `//fonts` - where `` is the root of the project, and `` is the value for `appPath` in the `nativescript.config.ts` - falling back to the default value of `app` & `src`). + +For each font we get the metadata with a package like [font-finder](https://www.npmjs.com/package/font-finder) and then output a css string with the correct values that can be copy-pasted right into any css file from the output of the `ns fonts` command (no manualy modifications required). From 1f8c048773ea748ee3c1cc01cb28e97849b284d9 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 29 Dec 2020 22:38:29 +0100 Subject: [PATCH 2/3] chore: move to landed rfc --- .../0001-ns-fonts-command.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename active-rfcs/0000-ns-fonts-command.md => landed-rfcs/0001-ns-fonts-command.md (100%) diff --git a/active-rfcs/0000-ns-fonts-command.md b/landed-rfcs/0001-ns-fonts-command.md similarity index 100% rename from active-rfcs/0000-ns-fonts-command.md rename to landed-rfcs/0001-ns-fonts-command.md From e210c0a1d222b12a3ae85e0e13b36f26a95293d3 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 29 Dec 2020 22:39:13 +0100 Subject: [PATCH 3/3] Update 0001-ns-fonts-command.md --- landed-rfcs/0001-ns-fonts-command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/landed-rfcs/0001-ns-fonts-command.md b/landed-rfcs/0001-ns-fonts-command.md index 5232db4..eb1f929 100644 --- a/landed-rfcs/0001-ns-fonts-command.md +++ b/landed-rfcs/0001-ns-fonts-command.md @@ -1,7 +1,7 @@ - Start Date: 2020-12-21 - Target Major Version: 8.x -- Reference Issues: -- Implementation PR: +- Reference Issues: N/A +- Implementation PR: https://github.com/NativeScript/nativescript-cli/pull/5452 # Summary