Comments (4)
The issue comes about when the font weight parameter contains more than one weight. This means that the font files provided for that particular font-face are to be used for more than one weight, there was also some issues when detecting fonts that didn't have local() options in the SRC which Oswald did not.
I was working on a fix that ended up finding more issues and I ran out of time on the project. I have listed my changes below if any help to anyone. I believe this issues is now being fixed in #47 although I am not sure if that fix has the multiple font weight part in it as mentioned in previous comment.
Updated detection for both Local and Font Weight
var re = new RegExp([
"\\s*font-family:\\s*'([^']+)';",
"\\s*font-style:\\s*(\\w+);",
"\\s*font-weight:\\s*([\\w\\s]+);",
"\\s*src:\\s*(local\\('([^']+)'\\),\\s*local\\('([^']+)'\\),\\s*)?url\\(([^)]+)\\)[^;]*;",
".*(?:unicode-range:([^;]+);)?",
].join(''), 'm');
Check see if local exists before outputting, added localBoth
function formatData(block, family, style, weight, localBoth, local1, local2, url, range) {
var name = [family, style, weight].join('-') + '.' + ext;
return {
family: family,
style: style,
weight: weight,
name: name.replace(/\s/g, '_'),
url: url,
local1: (!local1 || local1 === undefined) ? '' : local1,
local2: (!local2 || local2 === undefined) ? '' : local2,
range: range || 'U+0-10FFFF'
};
}
Did a replace on the local part to correct an issue
function makeFontFace(request) {
request.uri = path.posix.join(
options.relativePaths ? path.posix.relative(options.cssDir, options.fontsDir) : options.fontsDir,
request.name
);
request.name = path.posix.join(options.fontsDir, request.name);
return template
.replace(/\$(\w+)/g, function (m, name) {
return request[name];
}).replace(/(local\(\'\'\)\,\s)/g,'');
}
I didn't commit my work as it was never fully tested/finished, hopefully you might find it helpful.
from gulp-google-webfonts.
Upon looking into this further I think that the issues might be that the Oswald font comes back as a non standard font weight:
@font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 200 700;
font-display: swap;
src: url(https://fonts.gstatic.com/s/oswald/v23/TK3iWkUHHAIjg752FD8Gl-1PK62t.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
It would appear that the regX used (line 241 of index.js) to detect the font weight is not picking this up correctly.
Currently: "\\s*font-weight:\\s*(\\w+);",
Suggested: \\s*font-weight:\\s*([\\w\\s]+);
Also I have noticed that the are no local() parts in the returned font-face from google, would this also be a problem?
from gulp-google-webfonts.
I am also having this same issue but with the "Arvo" font - I tried to find a commonality between Arvo and Oswald but can't see any. Most fonts I tested worked fine but some returned ECONNREFUSED.
I also amended the regex as @danrwalker suggested but it didn't seem to make a difference for me - I believe Oswald is not returning font-weight 200 any longer.
from gulp-google-webfonts.
I am also having the same problem with Oswald. I try all the options but non of them are working. Below is the error code.
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1058:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket.EventEmitter.emit (domain.js:466:23)
at TLSSocket._finishInit (_tls_wrap.js:636:8)
from gulp-google-webfonts.
Related Issues (20)
- support fonts.list as string and not only from file HOT 1
- Support for SVG and EOT formats HOT 3
- &subset=cyrillic wrong font download
- Missing local src HOT 1
- Support for generate css with woff and woff2 fonts HOT 1
- How to set path for fonts in generated CSS? HOT 1
- woff2? HOT 4
- version without gulp? HOT 1
- HTTPS support HOT 3
- Set site root as font url HOT 1
- build fonts.list for gulp-google-webfonts HOT 1
- Process multiple font formats HOT 1
- New npm package for v3
- Attribute font-stretch doesn't match the regex HOT 1
- Example gulpfile.js's outdated
- "Google Format" wrong
- Alternative path to fonts for @font-face rules
- Fonts dir with starting slash
- Option to pass string instead of a file name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-google-webfonts.