typefaces icon indicating copy to clipboard operation
typefaces copied to clipboard

Allow to import character subsets other than Latin

Open erykpiast opened this issue 7 years ago • 32 comments

Solves https://github.com/KyleAMathews/typefaces/issues/21

erykpiast avatar Dec 06 '17 15:12 erykpiast

@KyleAMathews could you look at this, please?

erykpiast avatar Dec 16 '17 13:12 erykpiast

@KyleAMathews , any progress? Please add font subsets

koutsenko avatar Dec 18 '17 09:12 koutsenko

@KyleAMathews ping :)

erykpiast avatar Dec 21 '17 14:12 erykpiast

Tried it locally but it doesn't seem to be working.

Try running it locally:

  1. clone https://github.com/majodev/google-webfonts-helper
  2. Install its dependencies and start its server by running npm start
  3. Try creating a google font file — node scripts/create-package-from-google-font-id.js roboto

KyleAMathews avatar Dec 21 '17 18:12 KyleAMathews

Okay, I admit I didn't test with local URL, I'll try this.

erykpiast avatar Dec 21 '17 18:12 erykpiast

👍

Please post h ere the diff you get when it works.

KyleAMathews avatar Dec 21 '17 18:12 KyleAMathews

@KyleAMathews, which version of node do you use?

erykpiast avatar Dec 21 '17 19:12 erykpiast

8

KyleAMathews avatar Dec 21 '17 20:12 KyleAMathews

Alright, I cannot make google-webfonts-helper working with node v8, it's works on v0.10 though (typefaces repository works great on v8 and v9). I cannot say more than it works for me :P Clean node modules installation. Here is a video to prove it (maybe you will notice if I do something differently than you?)

erykpiast avatar Dec 22 '17 04:12 erykpiast

Video link isn't working.

KyleAMathews avatar Dec 22 '17 04:12 KyleAMathews

Agrr, sorry for this. Privacy settings. Try it now.

erykpiast avatar Dec 22 '17 05:12 erykpiast

Oh hmmm sorry — I ran yarn in typefaces and it started working, oops!

So yeah, managed to generate a bunch of new css files.

I'm not familiar with loading font files for additional languages. Can you really just require the latin & greek versions together? And the browser will figure it out? Looking at the CSS files, it seems they'd clash with each other since the @font-face stuff is the same except for which file it's pointing to.

KyleAMathews avatar Dec 22 '17 07:12 KyleAMathews

Yeah, this solution has a major flaw - it's not possible to include Greek AND Cyrillic charsets on the same page. I've copied default behavior of google-webfonts-helper, that means cyrillic.css contains Cyrillic and Latin characters, greek.css includes Greek and Latin and so on. This info is included in updated README of each font package I believe.

Well, there is probably better (I mean "ultimate") solution for this issue, like dynamically created CSS files for every possible combination of charsets, but until we want to stick to static files (which is quite good in my opinion, because it's simple), this one is the best approach I came with. Notice this one isn't breaking change, it shouldn't be major version update even :) So next iteration may be making it more generic/elastic.

The other idea I have is to create second sets of packages, like typeface-roboto-multilang and keep this one as it is for now, so it could be extended in more universal manner once we find out how.

erykpiast avatar Dec 22 '17 08:12 erykpiast

@KyleAMathews Is there a chance for you to come back to it this week? :)

erykpiast avatar Jan 01 '18 13:01 erykpiast

@KyleAMathews ping

erykpiast avatar Jan 08 '18 09:01 erykpiast

Hey, it's now more than two months since I've opened the PR. Could we do something with it, just move on?

erykpiast avatar Feb 15 '18 09:02 erykpiast

It's three months now :(

erykpiast avatar Mar 12 '18 09:03 erykpiast

Just a note, while waiting for this to be merged, would be useful to add usage instructions to the README.md

ryall avatar Mar 13 '18 13:03 ryall

@ryall It is in README. The one inside generated package :) Look at scripts/templates.js.

erykpiast avatar Mar 13 '18 13:03 erykpiast

Ah sorry! I didn't realise it was generated :)

ryall avatar Mar 13 '18 14:03 ryall

Would love to see this feature too. Waiting for ya, Kyle!

jsardev avatar Apr 18 '18 11:04 jsardev

And what we must to do now to install specific subsets? For example, roboto cyrillic?

koutsenko avatar May 15 '18 08:05 koutsenko

@koutsenko you can get this particular one through this package: https://www.npmjs.com/package/typeface-roboto-multilang. I've published it with code from this PR.

erykpiast avatar May 15 '18 09:05 erykpiast

@erykpiast thnx, but i already switched to roboto-fontface package. The only reason i tried to use typeface-roboto package was an material-ui-next project recommendations. Why your work wasn't merged here?

koutsenko avatar May 15 '18 10:05 koutsenko

Yeah, I also found this project because of Material UI :)

erykpiast avatar May 15 '18 11:05 erykpiast

@KyleAMathews ping about merging this please? Lack of support for Latin Extended stopped me from using typeface-hind (which looked really promising to streamline font installation and deployment), having to unfortunately devise some manual method of downloading and importing fonts which I am doing right now. Life would be just so much easier if I could use typeface-hind for Latin Extended (and not only for Latin). Thanks.

dusek avatar Jul 12 '18 09:07 dusek

how about including just the "full" source font file and let the user build the needed fonts by them self? you could include a simple Promise based tool, this should be a simple solution for this issue.

import gulp from 'gulp';
import fontUbuntu from 'typeface-ubuntu';

gulp.task('font', () => fontUbuntu({
  charsets: ['greek', 'latin'],
  styles: ['regular', '300'],
  dest: 'path_to_dest_directory',
}));

chpio avatar Sep 25 '18 10:09 chpio

@KyleAMathews one of the issues with not using GF API is that the API now uses unicode-range; it would be good to avoid this whole issue by doing the same :)

davelab6 avatar Jan 21 '19 18:01 davelab6

@KyleAMathews could this PR work? would need this too! thanks!

cezarneaga avatar Dec 06 '19 00:12 cezarneaga

@cezarneaga I've published this version of the project (Roboto font only) as the [separate package] (https://www.npmjs.com/package/typeface-roboto-multilang). Readme is not adjusted, so use it like require('typeface-roboto-multilang/latin-ext.css');

erykpiast avatar Dec 06 '19 08:12 erykpiast