I have recently converted a Flex3 AIR project to Flex4, so it now uses Flex4.1 sdk and <s:WindowedApplication>. It is a large project and having painstakingly updated all the vital bits of code to work with Flex4 it now happliy compiles.
Most of the components in the project decend over quite a few generations from an mx based component, so I have not yet updated this to spark due to the workload. The problem I am having is that I cannot get the embedded font to work for spark components that I now add to my mx components.
For example, I have edited one of my (mx based) components and added some items to it. My embedded font has to have embedAsCFF=false so that it works for my mx components. So to get this to also embed for spark, I should be able to simply embed it again with embedAsCFF=true as shown below:
#font-face
{
src: url("assets/fonts/MyriadWebPro.ttf");
font-family: mainWithCFF;
font-style: normal;
font-weight: normal;
font-anti-alias-type: "advanced";
embedAsCFF: true;
}
s|Label{
font-family: mainWithCFF;
}
I have tried a basic example of this that Adobe provides and this example works just fine, but in my complex project, it does not work. I do not get any errors, but instead of the spark component using MyriadWebPro it defaults to Times.
I wonder if this is because my component is mx based rather than spark based. Maybe this only works if you are using an mx component inside a spark component? If so does anyone know of a solution to the problem where you have an mx component and want to have a spark Label inside that?
If your component is MX (Halo), you want embedAsCFF to be false.
For Spark components, you embedAsCFF: true.
Also, I'm not sure your advanced Anti Aliasing is correct.
Spark Example:
#font-face
{
font-family: "Myriad Web Pro";
src: url("./assets/fonts/MyriadWebPro.ttf");
font-weight: normal;
embedAsCFF: true; /* Spark */
advancedAntiAliasing: true;
unicodeRange:
U+0041-U+005A, /* Upper-Case [A..Z] */
U+0061-U+007A, /* Lower-Case a-z */
U+0030-U+003F, /* Numbers [0..9] */
U+0020-U+002F, /* Space + Punctuation [ !"#$%&'()*+,-./ ] */
U+003A-U+0040; /* Special Chars [ :;?# ] */
}
MX Halo Example:
#font-face
{
font-family: "Myriad Web Pro";
src: url("./assets/fonts/MyriadWebPro.ttf");
font-weight: normal;
embedAsCFF: false; /* Halo */
advancedAntiAliasing: true;
unicodeRange:
U+0041-U+005A, /* Upper-Case [A..Z] */
U+0061-U+007A, /* Lower-Case a-z */
U+0030-U+003F, /* Numbers [0..9] */
U+0020-U+002F, /* Space + Punctuation [ !"#$%&'()*+,-./ ] */
U+003A-U+0040; /* Special Chars [ :;?# ] */
}
Related
I'm working with laravel in a project and I downloaded a google font using the google-webfonts-helper app to use the font offline, but i'm getting this error in my browser:
GET http://127.0.0.1:8000/css/public/fonts/nunito-v14-latin-800.woff2 net::ERR_ABORTED 404 (Not Found)
this is the css call
<link href="{{asset('css/fonts.css')}}" rel="stylesheet">
and this is a part of fonts.css file (i didn't put all the code because it's basically the same just different font weights)
#font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 200;
src: url('public/fonts/nunito-v14-latin-200.eot');
/* IE9 Compat Modes */
src: local('Nunito ExtraLight'), local('Nunito-ExtraLight'), url('public/fonts/nunito-v14-latin-200.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('public/fonts/nunito-v14-latin-200.woff2') format('woff2'), /* Super Modern Browsers */
url('public/fonts/nunito-v14-latin-200.woff') format('woff'), /* Modern Browsers */
url('public/fonts/nunito-v14-latin-200.ttf') format('truetype'), /* Safari, Android, iOS */
url('public/fonts/nunito-v14-latin-200.svg#Nunito') format('svg');
/* Legacy iOS */
}
I pasted the fonts files in public/fonts, the browser actually recongizes the css file but I dont know what i'm doing wrong
in laravel the url function is rooted in the public folder. So if you paste your font file into public/font/file.ttf please use url('font/file.ttf') instead of url('public/font/file.tff'). Because it will point to the public/public/font/file.ttf file
With 0.12.x version of Compass, I was defining support for oldies that way:
#import "compass/support"
$legacy-support-for-ie6: false;
$legacy-support-for-ie7: true;
$legacy-support-for-ie8: true;
$legacy-support-for-mozilla: false;
#if ($legacy-support-for-ie7) {
// specific declaration if ie7 is supported
}
I'm wonder how I should define browser support following Compass 1.x system.
Maybe something like that:
// Add support for a specific browser
$browser-minimum-versions: (
'ie': "7",
'ie': "8"
);
// Reject browsers
$supported-browsers: reject(browser-versions("ie"), "6", "7", "8");
But it returns that error (running on Compass 1.0.1):
(Line 206 of /Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.1/stylesheets/compass/_support.scss: 5.5 is not known browser.)
Excluding browsers is done by modifying the $graceful-usage-threshold variable. If Browser X only has 4.99% of the market share, you want to set it to 5.
$debug-browser-support: true;
$browser-minimum-versions: (
"ie": "9"
);
$graceful-usage-threshold: 4.46163;
#import "compass";
.foo {
#include opacity(.5);
#include border-radius(10px);
}
Output:
.foo {
/* Content for ie 8 omitted.
Minimum support is 9. */
opacity: 0.5;
/* Capability border-radius is not prefixed with -moz because 0.25036% of users are affected which is less than the threshold of 4.46163. */
/* Capability border-radius is not prefixed with -ms because 0% of users are affected which is less than the threshold of 4.46163. */
/* Capability border-radius is not prefixed with -o because 0% of users are affected which is less than the threshold of 4.46163. */
/* Capability border-radius is not prefixed with -webkit because 0.1583% of users are affected which is less than the threshold of 4.46163. */
border-radius: 10px;
}
Note that this causes other minority browsers to be excluded that you may want to support. That's when the $browser-minimum-versions comes into play.
$browser-minimum-versions: (
"ie": "9",
"safari": "4"
);
Output:
.foo {
/* Content for ie 8 omitted.
Minimum support is 9. */
opacity: 0.5;
/* Capability border-radius is not prefixed with -moz because 0.25036% of users are affected which is less than the threshold of 4.46163. */
/* Capability border-radius is not prefixed with -ms because 0% of users are affected which is less than the threshold of 4.46163. */
/* Capability border-radius is not prefixed with -o because 0% of users are affected which is less than the threshold of 4.46163. */
/* Capability border-radius is prefixed with -webkit because safari "4" is required. */
/* Creating new -webkit context. */
-webkit-border-radius: 10px;
border-radius: 10px;
}
There are changes in the works to make it easier to exclude old browsers. You can follow them here: https://github.com/Compass/compass/issues/1762
If you want to make rules for a specific browser, then the $critical-usage-threshold variable comes into play:
$debug-browser-support: true;
$browser-minimum-versions: (
"ie": "9"
);
$critical-usage-threshold: 4.46163;
$graceful-usage-threshold: 4.46163;
#import "compass";
.foo {
#include for-legacy-browser('ie', '8') {
color: green;
// this is based on $critical-usage-threshold by default
// if $critical-usage-threshold is lower than the version's usage
// then this content will be generated
}
#if support-legacy-browser('ie', '8') {
color: red;
}
}
I have been using sass for a while and for ages I have been using the following px to em function for my media queries:
$browser-context: 16; // Default
#function em($pixels, $context: $browser-context) {
#return #{$pixels/$context}em
}
However, I am now wanting to set up a different base font size depending on width of screen. SO for instance for mobile sizes
$browser-context: 14; // Default
and for bigger screens:
$browser-context: 16; // Default
But Im not sure how to wrap this all up in sass. Any ideas?
Thanks,
I'm pretty sure that this won't be achievable in SASS without thinking outside the box.
SASS, as you know compiles before getting sent to the browser, therefore, at that point we have no idea what browser, let alone what screen size. Therefore, media queries are out.
What you could do (I'm theorising here) is:
Set up you em function to produce a series of font sizes specific to different browser widths e.g.
#function em780($pixels, $context: $browser-context) {
#return #{$pixels/$context}em
}
and
#function em420($pixels, $context: $browser-context) {
#return #{$pixels/$context}em
}
etc.
This should produce the correct em size for each specific screen width. Then, assign those em sizes within a normal media query
#media all and (max-width: 420px){
h1{ font-size: $em420;
}
#media all and (max-width: 780px){
h1{ font-size: $em780;
}
Does that make any sense ?
Obviously, don't copy the 'code' I've written here but hopefully the general idea is valid.
This is my mixin:
#function em($px, $base: 16px) {
#return ($px / $base) * 1em;
}
use it like font-size: em(24px);. I think it is more clear then just typing values
I am using the #font-face. I had to break it up into two section because firefox continued to use the first font and it showed up crappy. Actually it still displays blurry/pixelated in firefox. Any solutions for that? Anyways it all seems to work fine now, but I can't get any of the bold functions to work. Doesn't seem to matter where I add it in the code whether it is in the CSS or directly in the html it work make the font bolder. Is this normal?
#font-face {
font-family: TektonPro-BoldExt;
src:url('../fonts/TektonPro-BoldExt.eot') format('embedded-opentype'), /* For IE */
url('../fonts/TektonPro-BoldExt.eot?#iefix') format('embedded-opentype'), /* For fix-IE */
url('../fonts/TektonPro-BoldExt.woff') format('woff'), /* For new-IE */
url('../fonts/TektonPro-BoldExt.otf') format('opentype'), /* For non-IE */
url('../fonts/TektonPro-BoldExt.ttf') format('truetype'), /* For non-IE */
url('../fonts/TektonPro-BoldExt.svg') format('svg'); /* For non-IE */
font-weight: bolder;
font-style: normal;
}
#font-face {
font-family: TektonPro-BoldExt-FF;
src:url('../fonts/TektonPro-BoldExt.otf') format('opentype'); /* For Firefox */
font-weight: bolder;
font-style: normal;
}
Not all fonts have a bold spite that can render as bold. You can try adjusting the font-weight in increments of 100 to see if that makes any difference.
Regarding Firefox using the first font, do you mean it was caching another font you used before?
I'm having trouble with CK4 and getting the styles for headers reflected in the styles-dropdown.
The .css should be shared of both back- and frontend and uses #page as css-id
Is there any way to tell the dropdown to parse headers with the #page-prefix.
I'm using
CKEDITOR.config.bodyId = 'page';
and css
.cke_editable {
}
#page {
/* works - editor area goes black..
font-family:Arial;
margin:10px;
font-family:Arial;
background-color:#000;
font-size: 10px;
color:#fff;
}
#page h1 {
/* works in editor-area, but not dropdown */
font-family: Verdana;
color:#999;
}
.cke_editable h2 {
/* same as h1.. */
font-family:Arial;
color:#f00;
font-size:16px;
background-color:#999;
}
h3 {
/* work BOTH in editor and style shows in dropdown. */
color:#0f0;
}
I guess that you're about to use stylesheetparser plugin to parse additional selectors. This issue has already been answered here: CKEditor - Stylesheet Parser - Valid Selectors
It's not straightforward but I believe you'll manage to do this. Good luck!
The problem is that CKEditor doesn't apply the bodyId and/or bodyClass to the styles combo: http://dev.ckeditor.com/ticket/7452
As you can see that bug was reported almost two years ago and it has been without activity from the developers most of that time.
I achived a working solution by parsing the css e.g.
#page h1 {...}
when attaching to CK like:
['config']['css'] = 'parseMyCss.php?theFile=style.css
and in parseMyCss (simplified):
$s = file_get_contents($theFile);
$s = str_replace('#page ','', $s);
header('content-type:text/css');
echo $s;