Placeholder Image

字幕列表 影片播放

  • thank you very much.

  • So, yes, I'm gonna talk on kind of build on some of our themes that have been emerging today a little bit about how we go about participating.

  • So this is either a really designed, focused technical talk or a very technical design talk.

  • Choose your own adventure here.

  • That's just fine.

  • So I do spend a lot of time playing around with variable fonts.

  • I have since day since they launched.

  • And one of the recurring themes for me is this notion of participation meeting people from different browser vendors.

  • Different, huh?

  • Different fund companies and trying things, experimenting and providing feedback.

  • And so, for me, as a designer on a developer has worked on the Web for actually 25 years, my Web curry is probably older than half the people here.

  • But that that has led me to be able to participate more than I ever have before just by speaking up just by going in, commenting on issues and trying things out, providing some use cases.

  • And I'll show you some of those things today.

  • Really, most people just know me as a walker of these two.

  • Um, so they're going to come back and help me kind of explain a couple things, but so I spent most of my time working on type and typography and design systems and for browser vendors and that sort of thing, writing content about it, trying to educate people about it.

  • But I've had people in Australia asked me first how Tristan's doing.

  • So that's Tristen on the left, and it's his cousin Tilly on the right, and they'll be back to explain some things later on.

  • So the reason why I think this stuff is so important there's there's lots of reasons for performance and everything else.

  • But type is the voice of our words.

  • It's how we hear what we read.

  • And so all of the tech stuff fixing performance problems with font loading, that's the gateway toe actually get in and do better typography in the first place.

  • And this is one of the reasons why.

  • So when this quote came across, I was like the day before I was giving this the first version of this talk for the first time, and and I had to work this in because I think Nina's notion of friction in design, what creates that interface between what I put on screen and what you read.

  • That's what makes it memorable.

  • And sometimes you want more friction.

  • Sometimes you want less.

  • But type is the way we can modulate that.

  • I think that's really fascinating.

  • So what I want to look at is actually combining several different CSS techniques to create more interesting and fluid typography.

  • And then we can also tie in some other emerging features that will help make that typography more interesting and more useful in more scenarios to more people.

  • So there's three things that we're gonna talk about primarily, and that is CSS custom properties or variables thehe bility to do calculations with them and pairing that with variable funds.

  • So variable fonts.

  • I hope it's something that you've all at least heard about.

  • But if not, I'm gonna explain a little bit more about what they are in a minute.

  • So looking at what we have unscreened, I thought the Odyssey might be a good way to talk about the way our journey on the Web has evolved, and I wanted to try and present it in a slightly different way.

  • So we have a heading, and instead of assigning it an explicit color.

  • We could sign it a variable for that color, so we might change it later on.

  • And I think that we'll have some interesting use cases for that.

  • So this is totally not showing things properly.

  • Sorry.

  • Okay, that's what it's supposed to look like.

  • So we have the color assigned and we want to start to change those things.

  • So we change that variable assignment.

  • And so now we have a different color heading.

  • We might also want to do a calculation on the size so that we could then change that base sides later on as we start to scale it on different screen sizes.

  • So we've now done things like changed the size, and that actually altered the flow of the text a little bit.

  • So we might want to.

  • Actually, a sign of variable to the wait is well, so as size changes, we might impact that.

  • So here's where the variable fonts come in.

  • We have that single asset that we can then use in a greater variety of ways, and this is actually where I want to pause for just a second and bring up the idea about when we read advice about things we do on the Web.

  • We need to think about why that advice exists in the first place.

  • So I see a lot of people writing about what is good typography and a lot of people will talk about.

  • These are our experienced designers.

  • We'll talk about good typography being on Lee, using two weights of a font that's actually not good typography at all.

  • That's convenient for performance, and that has been sort of codified as away.

  • We should do things because of the reality of how we serve things on the Web, so it makes for better user experience.

  • If you get content on screen and you're only loading two assets, that's a smaller amount of data, so that makes sense.

  • But that's not actually good Typography.

  • A single weight of a typeface, as you change it in size, will become more or less clear and easy to read.

  • If you can modulate that, wait a little bit at every different size, you'll get clearer and more legible type.

  • So there's reasons why we might want to do this sort of thing.

  • And I also wanted to show that some of these ideas work equally well in the context of a design system.

  • So it's not something that is purely for one block long form copy.

  • But when we take this thing and we've got our card, so I don't have a box around it.

  • But, you know, cards are a theme.

  • We know we were going to sub grid on them and everything, and we have them here in the bottom part of the layout.

  • But if we stick them over on the side, maybe we scoped the change in size or scale of that typography to where it's placed in the layout.

  • So again, we don't have to write any new mark up.

  • All we have to do is tweak some of those size variables, and that could be dependent upon where things are placed, and that's really kind of interesting.

  • But let me come back to variable funds because one of the things that I've learned is every time I think I've been rattling on about them enough.

  • I'll go to another event and people don't actually know what they really look like.

  • So when you load fonts, you typically have a whole bunch of different files that you need to load in order to get all the different weights and variants, whether it's with weight, metallics, all that sort of thing.

  • But variable font actually brings all of that together in a single file.

  • So now you're loading one asset, which is bigger than a single static file.

  • But not so big is what you want to combine, and it gives you then access to the whole range of that set of weights or wits all at once, rather than having only one or two.

  • So Tristin, until he again, will help me out where we have variable sized collies and you can have that single fought file that you're loading and then playing around with all of these different characteristics.

  • And I hope you'll pay attention to some of the classes that have been applied here to make sure that we're really focused in on exactly what we're talking about.

  • These axes are ones that are chosen to be exposed by the type designer.

  • They're not distortions introduced by the browser there only what is native inside the font itself, so you'll see a lot of different variable axes exposed, and we're still kind of learning what some of those axes might be, but the more common ones that will be useful to us for you.

  • I particularly will be things like width and weight.

  • It just creates a lot more opportunity.

  • But we also don't want to forget that we also have slipped.

  • Now we have all of these things available to us.

  • But one of the things that is often overlooked in a responsive design is how that typographic scale needs to move and change based on screen size.

  • So we have a small screen.

  • You have less distraction in less space for that content to show up.

  • So you don't really want to have the same scale between heading and body copy on a big screen and a small one.

  • So when you have an H one that's still appropriately sized, you understand that that's the title.

  • It's the most important piece of information on the screen.

  • We're going to start to scale this, using all of these things together.

  • We're going to set a bunch variables for break points and minimum and maximum sizes for in this case, the paragraph, size and line height.

  • And so these are the things that we're going to move around and scale based on that screen size, rather than using explicit break points to change things all the way along.

  • We're going to start to do this a little bit differently.

  • We're gonna use some of these calculations.

  • So as it changed, what happened, there was the font size and the line height started to change with it.

  • And so as the screen got bigger, we started to use stuff like this.

  • And I know that's a lot of somebody who's Greg from the Edge Edge team last night said, Are you gonna put that really stupidly long formula up on the screen that I said Yes, yes, I am multiple times, but I'll explain it.

  • So this is kind of what's going on.

  • And this is based on a technique that Tim Brown wrote about a while ago called CSS Locks.

  • Now some of you have probably played around a view port with units to size text, and that's really interesting, and it helps to size text based on the sides of the window.

  • But it has a couple of problems in Estelle.

  • While was the first person that pointed out to me that when you use purely view port units to size text.

  • You can't zoom it.

  • So you've created this huge accessibility problem because it's based on the window, not paged him.

  • So when you calculate it on, introduce another unit of measure.

  • The end result can still be zoomed, so that alleviates the accessibility issue.

  • But you also want to stop it from getting too small or too big.

  • So this is where the locks idea comes in.

  • You can assign a minimum and maximum size and then tie it to different break points so that it will get no smaller when it's on a very small screen and no bigger when it's on a very large screen, and it gives you a little bit more control without having to worry about everything in the middle so effectively you're still using break points, but only at the low end in high end of where you want it to start and stop scaling.

  • And so this is what it looks like in story form.

  • So please take this item and scale it from this size up to this size, starting at this screen size and ending at that one.

  • So we start to replace these values in the formula gets a little bit simpler, and this is about the point where I throw my hands up and walk away because browsers or better enough than I am.

  • I didn't really take any college math, either, so that Z this is as far as I go.

  • But browsers a really good at it, and that's fine, and you don't ever have to rewrite it.

  • So he used that exact same formula.

  • I've taken that around from dozens of different demonstrations and workshops.

  • It's in production in several different Web sites, a couple of which I'll show you later on, and we're then going to see how that actually looks in the real world.

  • So we take all these things and put them together.

  • And instead of having on Lee a couple of things happening, we're actually going to tailor a whole bunch of things here.

  • The width of the text, the weight of it, the size, the line height, all of those things.

  • They're gonna scale nicely as we go from small screen, too large.

  • Now, why might we want to do that on small screens?

  • We have fairly choppy line lengths when you have the text size set at a good readable 100% size.

  • So rather than make the body text smaller, we could make it a tiny bit narrower if you have a with axis and that will fit more characters per line and give you a little bit more, even reading experience without really sacrificing the ledge ability.

  • So we're doing a whole bunch of other stuff.

  • We're setting variables not only for the size and line height, but we're also setting it for wit, and we're doing the same kind of thing as we scale.

  • You'll notice that not only what's gonna change here is the with the weight as well as the line heightened the size as the scales.

  • So it's appropriate for the device size.

  • It gives you a good, clear reading experience optimized for the size of the screen upon which it's viewed.

  • And that's really important because content is, well, whole point of what we're putting on screen.

  • Unless it's a game or the kittens, the kittens should just be a 100% right.

  • Well, dogs, not cats, anyway.

  • So here's another example of this in action.

  • So this is a page that I designed for monotypes introduction of the FF meta is their first variable front lunch.

  • And so this is Justin in bed.

  • That's a really real Web page.

  • All the stuff that you're seeing here are actual production fonts or, most never production.

  • Some of them are open source, but everything that's on the screen here is from one file.

  • So a single font File 84 k replaces 18 separate files to print.

  • Create this beautiful range of typography.

  • Now I say Beautiful range.

  • I'm not saying beautiful typography.

  • I happen to like it, but I don't want to imply that that judgment is absolute.

  • And so that also moves in scales really nicely.

  • So this is using a lot of the same ideas on the slightly earlier it oration.

  • But what doesn't have the wit?

  • But it does create an interesting layout and solution based appropriately for the screen size that it's on.

  • This is another quote from Tim Brown, because I think this is really important, and this is a theme that I've seen emerging at a bunch of events in different talks this year, where we need to remember that we're not dictating the experience to the user.

  • We're giving them an experience which they can then choose to take or not, and they can override it with user preference.

  • They can override it with Paige Zoom and increasingly want to be mindful that we should give them the ability to find tune that experience based on their needs.

  • It might be ambient light.

  • It might be low vision.

  • It could be different kinds of cognitive issues that made that they may face.

  • So why not use CSS and a little bit of Java scripts All include everybody from Tomorrow and Sunday as well that we can improve this experience with a few simple things to give people the choice about how they want to take in this content.

  • So one of the things that has become pretty popular is the idea of using light and dark mode, so it's built into a lot of different operating systems now.

  • It's, oddly enough, not available in IOS, and I was really kind of surprised about that.

  • But it does work.

  • It's shipping now.

  • The respect for that in immediate query is built into safari and fire Fox.

  • And if it's not shipping yet in chrome, it's just about to it does work.

  • If you have a flag set, it's working in my browser anyway.

  • So if I wanted to just pop over to my system preferences, Andi, go back here.

  • It's under general.

  • And if I just select dark mode, I didn't change anything in the code.

  • I just have a few things in the media query so that if the user has set that preference, I can invert a couple of things, and it's really easy to do based on the absence or presence of these variables.

  • So inside the media query here prefers color scheme dark.

  • Then I'll have to do is replace a couple of different values for those variables, and it just inverts the whole color palette.

  • And as an experiment, I added this to my own website last week and took me about 20 minutes to go through and find all the places where I needed to swap out those variables.

  • So it's actually it's kind of incredibly easy thing to do, and I go back here.

  • What I want to do is actually I cheated a little bit.

  • I have a class on here is well, but watch what happens when I enable the dark mode.

  • I'm also increasing the grade of the text slightly.

  • That's another variable access, so it increases the weight subtly without shifting the space around the letter forms.

  • And I also increase the letter spacing.

  • So a couple of small tweaks to the typography using basic CSS on the on the variable axis creates that better, more tailored reading experience in that inverted light mode, which for some people is the difference between being able to use the computer and not so it really does behoove us to try and make sure these things are available.

  • So going back here, there other cases where we might increase great of text.

  • And this for people that have either a low ambient light situation or they have low vision, meaning they they need a little bit stronger contrast.

  • In order to make out that fine detail well again, we can tie into without inverting the color mode.

  • We can still create a slightly more readable experience.

  • We'll go back and forth a little bit.

  • There you can see I'm doing the same kind of thing, like increasing the grade, opening up the letter spacing just a little bit.

  • It creates a more legible experience for someone that that needs that extra little touch.

  • We could also play a round of font size.

  • So again weaken.

  • In this case, all I had to do is redefine the scaling values, the low in the high end, and then everything else kind of moves along with it.

  • We can also do things like address crowding.

  • Crowding is a particular subset.

  • It's a condition that a subset of people that have dyslexia suffer from and actually learned about this from, um, Kevin Larson from Microsoft Advanced Reading Group did a really great talk about this research, and what they found was that in people who suffer from crowding and it's it's not everybody with dyslexia, it's a subset.

  • What they discovered was that if you could increase the word spacing and line height, they could increase reading cognition by 50%.

  • That's a massive increase for people.

  • That is again the difference between getting something from your site and not it's opening and closing a door to people toe learning to experience to entertainment.

  • You name it with really simple stuff.

  • So again, words facing line height modify those two variables, make it easy put thes controls in the hands of the user.

  • So what, that might that look like?

  • Well, if we could actually just put a little panel off to the side on our website, and all it does is toggle some classes on and off that will trigger those little bits of CSS weakened, then again put it in the hands of the user, allow them to control that experience.

  • It doesn't take much time for us.

  • The net cost in a project is zero.

  • I'm not kidding.

  • I mean, like, this is a tiny amount of effort to put in a cross the scope of the whole project that will then make the difference between I can use this site or I need to go somewhere else.

  • And we want people to be able to use our sights.

  • So I think it's really important that we keep that sort of thing in mind.

  • And the other thing that we might do again, because this is a lot of effort to create great typography.

  • We want to be able to reuse this effort as much as as we can weakened, then extend it a little bit more to make the whole system itself seem a ball, so we could actually used this stuff over and over on other projects by using a variable for the font stack itself.

  • So as this stuff moves around in scales, we could also that based on grid placement, we can actually shift around what values we apply.

  • But we could also changed the entire look itself.

  • And that might be by just adding a few more variables that are tied to the font stack that we enable which one is primary and then tie things to screen size, light mode, all different kinds of things that we might be able to do.

  • But that makes this whole system a series of files.

  • We could drop into any project so that, you know, we want efficiency.

  • We want to work in design systems.

  • We want to be able to replicate all this stuff.

  • Then we want to be able to get the most out of it that we can.

  • So we figure this stuff out in a system we take it from one project to the next.

  • I can tell you from experience.

  • Now, over the last couple years that it has saved me a ton of time, and it has enabled me to bring all of this into a production system for one of the larger states in the U.

  • S.

  • So that brings me to this Georgia dot gov I was asked to come in and work on the typographic system for all of their state agency website.

  • So this is one platform, one pattern lab instance in droop A ll, and we were able to take all of the ideas that I've been showing you and build that into this whole system.

  • And so we have everything here.

  • So this is this is an actual copy of the pattern lab that exists for all of the sites.

  • And if I go play around with all of this, you can see the scaling happening live everything.

  • It's all the same kind of math using at supports.

  • It's delivering static Web funds for I 11 variable fonts for everybody else.

  • So that's another little plug there.

  • The browser support for variable fonts, every shipping browser I 11 still does not support it, so that is a reality.

  • But using at supports and your CSS will enable you to bring this into your project safely and use it in production.

  • It's actually not that hard to do toe add in a block that just redefines the variable sponte support and just layer it into your arrest.

  • Your project.

  • So they've just started launching.

  • These sites have been working on this for the last 89 months or so, and so now they've got a couple of different live Web sites there.

  • It's all in triple, so they've got lots of flexibility to build the different content types.

  • But they've actually started to roll this out now, and this will be powering 80 to 100 websites across the entire state of Georgia, so it is very much production ready.

  • It's really nice to see, and they're not the only people doing this.

  • So IBM fairly large company.

  • I'm guessing most of you have heard of them.

  • They just released Plex stands a couple years ago and has a beautiful family of typefaces that they made open source.

  • And that's core to their entire identity.

  • Well, it so happens just about a month ago, they released a variable fun version of black sends.

  • 16 files totaled 960 K in a weight range from 85 to 100% weight range of with range from 85 200 await range from 100 to 700 italics.

  • So all of that stuff replaced with two files at 233 cats.

  • Now, you might think that's still a lot to load in front data, but it's catchable, and it gives you an incredible range of stuff, and it's a hugely internationalized fun.

  • So if you were to localize it just for, say, Latin one extended, you'd bring down the number of cliffs in there and you haven't even smaller file.

  • So you get a tremendous amount out of that, and I just want to show I know other people have been kind of carrying on about the Firefox deaf tools.

  • But, man, they are so cool.

  • So one of the things that I know you're not gonna be able to read that That's okay, the front panel.

  • So I'm gonna actually get out of this mode so you can actually see it on screen here.

  • So if I accept my full screen on Dhe, inspect this again.

  • What I want to show you is I have selected that first line of text and If you look at the font panel over here, you'll see that it shows you what font has been selected and what's what's enabled there.

  • It gives you the basics of size and line height and whether or not it has a talents or not.

  • But it will also expose the any available axes in the variable fund.

  • So in this case, you've got width and weight, and I can now play around with that live in the browser.

  • So this comes up a lot when I'm working with both designers and developers who have to work together.

  • This is a conversation facilitator.

  • This allows a designer to go into the browser and look at a test harness of a page or in existing existing mock up or early iteration.

  • Or maybe a building a PR and play around with the type, get things exactly the way they want it.

  • And then they could just click on the changes tab.

  • There's another really awesome little tidbit in in Firefox step tools.

  • This is where all of the changes that you've just made in the Inspector are going to show up.

  • So then you can just copy that and hand it back to the developer and say here so if you can't code it yourself or if you just want to use these shortcuts to kind of play with things and then you can always see everything that you've changed font values, padding, alignment, all of these different things that you've been playing around with, this is where it accumulates.

  • So then you can figure out everything that you've changed, which is just really fantastic.

  • So that's my plug for Firefox of tools and and I will Do you want to say out loud that people from both Chrome and EJ team have approached me and had conversations with me this week about wanting to improve these things in other browsers as well.

  • So competition is good.

  • People really do care about this stuff.

  • You're gonna Seymour of these incredible tools coming from different browsers as well, and that's just gonna make our design life that much better.

  • So a big round of applause to the deaf tools teams at all the browsers.

  • One more thing as part of my work with the W three C.

  • What we've been chartered with right now is something that's really new, and it's it's still a year to away before it ships.

  • But this is a bit of a tease because it's so important about fun performance in the first place that I wanted to give you a little advanced preview.

  • What we're working on is something called progressive font enrichment.

  • And don't worry, I've got a link to a noticed page that has all of this stuff on it with tons of links, and resource is so you'll easily be able to kind of check all of this stuff out.

  • But this demo is live on the web.

  • So this is really stuff that I'm showing you and we have the ability to take a look.

  • I'm gonna choose a variable fonts.

  • Where to go?

  • This is there it is.

  • Sorry.

  • So the idea is we want to be able to download on Lee the amount of font information that you need to render the page rather than having to do this on an every page basis.

  • We want it to be cumulative.

  • So you look at the first page of your website and it downloads the 47 cliffs of font data that are required to render that page when you go to the next page, it might only require 12 more.

  • So we want to rather than throw these things out, we're talking about dynamically sub setting the fun, but then building it back up in the browser and that's really kind of incredible.

  • Yes, well, just wait till you see it in action.

  • So I'm just gonna copy the 1st 2 paragraphs and this is this is a long page.

  • There's a lot of text.

  • Here is the entire first book of the Odyssey.

  • So I'm gonna take the 1st 2 paragraphs and go back over here, and I'm making a couple of choices about which sub setting tools this is.

  • This is a totally experimental thing.

  • This is basically here for us to test research while we're working on the specifications.

  • And I paced those two paragraphs in, I add them.

  • Here's my demo content.

  • There's what's happening.

  • So there's the full fun Would be 21 K.

  • That's what would get sent today with that front and what was served for this page is down on the incremental transfers line.

  • See?

  • So it's 1/3 1 down.

  • That was 6.5 K was the only amount of fun data that was sent.

  • So that's, you know, almost 25% or so instead of 100% of the front file.

  • So let's go back and grab the whole rest of this first book select here all the way down to the bottom.

  • So I'm selecting a whole lot of text.

  • Well, let's see what that does in terms of the different number of cliffs.

  • So I copied that.

  • I'm gonna go in here, add this.

  • And here we go 3.7 K.

  • So still, even with all of that text, we're only serving half of the whole fought file.

  • Now this is peanuts.

  • When you're looking at wet Western languages, this is not where it matters, although it's still going to improve things when we talk about those variable funds, think about that one from IBM instead of 233 K.

  • We might be serving 12 but think about Arabic.

  • Typical Arabic font could be 2.5 Mex or something in C, j, K, Chinese, Japanese or Korean.

  • That might be 16 megs or might be 20.

  • So, again, this is the difference between being able to use it and not, and the fun directly relates to readability, so system fonts are fine, but they may not be the most legible or the most appropriate.

  • So Web thoughts really are important.

  • And this is why we want to make sure that we have these kinds of things available again.

  • This is participatory.

  • This will all be going as soon as we have enough research here.

  • It's going to be all on Get Hub.

  • Everybody gets to comment.

  • Everyone gets to test things and participate.

  • So this is why it's such an exciting time to be working on the Web because it's easier for all of us to participate than it ever has been.

  • So that was what I wanted to show you with this demo bit here.

  • So I'll speed past those again.

  • I wanted to give you access to things, so there's lots of different variable fonts that I used in this presentation and where you can find them.

  • Some of them are open source.

  • Some of them are commercial, some of them are just in beta.

  • But if you want to take a picture, grab this last one.

  • That link down on the bottom has all of this stuff available.

  • You can also sign up for an email newsletter that I do every week about Web typography, where a lot of these conversations start and thank you very much.

thank you very much.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

A2 初級

現代排版系統與可變字體--傑森-帕梅恩|CSSconf EU 2019 (Modern Typographic Systems With Variable Fonts - Jason Pamental | CSSconf EU 2019)

  • 2 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字