fluid typography - SOLVED


  • Admin

    There’s two reasons why I’m asking anyone to create a PR:

    1. For the person to get the credits
    2. We really have our hands full atm 😞


  • @rstoenescu @s-molinari

    Hmm, as an unfortunate author of this charming “solution”, please take my advice and do not incorporate this trick/hack at the framework level into Quasar. Yes, it looks nice in developer eyes, but it is valid only in specific situations and taking it out of the context of the whole typography would be IMHO more hurting to the image of Quasar as a CSS web pages platform.

    Why?

    1. Typography is about visuals, rhythm, beauty, composition. This hack is an algorithmic take on font sizes and it is linear in nature. In reality, the scaling of visuals should be non-linear and adjusted to the page purpose, specific font etc. If we will encourage designers considering Quasar as their next tool, to use linear design (at the framework level), they will laugh us off. It should be a developer decision if he wants to use linears in his specific web page.

    2. Yes, it is only part of “typography” as a whole and it is rather crippled part. The more advanced take to font scaling (only) at the LIBRARY level is here:
      https://github.com/twbs/rfs
      If at the APP level, one would want to use this LIBRARY, then one would only need to:

    npm install rfs --install
    

    and in their app.styl code:

    @import "../../node_modules/rfs/stylus";
    

    Why is it encouraged to use this library and not incorporating anything into the framework? It is not recommended because you lose the ability to easily and quickly manage and update RFS as a dependency. Why is it important? Because for example “my” solution doesn’t work fully on safari browser. There are specific quirks which this library handles and my hack does not. There is a documentation of how and where use or not to use scaled fonts (not on HTML tag).

    1. Why typography is so important on web pages (and even on web apps)? What is this typography anyway? Well, there are so many tutorials, books and knowledge. Those are interesting at the beginning:
      https://css-tricks.com/typography-for-developers/
      This one touches of the tip of the iceberg - rhythm:
      https://www.webfx.com/blog/web-design/css-typography-02/
      There is a beautiful parable - I’ll cite “The concept of vertical rhythm is simple: Line heights, margins, and padding should all be equal or within even proportion.”. Even if a daveloper knows how to use CSS typography properties (so many…) does she understands what rules needs to be followed and which ones could be broken?
      This is nice one too:
      https://practicaltypography.com/
      … and many more.

    2. What can I do anyway? Well I’m strongly encouraging to somehow incorporate Bootstrap design concepts into Quasar, but not necessarily at the framework level, but rather as friendly agreement to “not reinvent” Quasar own solutions, in a way, which would prevent using of knowledge and solutions accumulated in Boostrap as a concept. As I said in previous posts, the key is to convince thousands of developers from Bootstrap to convert to Quasar.

    3. Can I use Boostrap already in Vue and link it with Quasar? There are solutions at the Vue level for example:
      https://bootstrap-vue.js.org/
      https://medium.com/@BjornKrols/integrating-and-customising-bootstrap-4-in-vue-js-cbc29ba7688e
      But they won’t be rather compatible with Quasar, because Quasar, at the framework level, intentionally or not, is using similar CSS classes to Boostrap, and it would just make a mess if one would want to use those two CSS system at the LIBRARY level.

    4. Why am I differentiate “framework”, “library” and “app” level? At the framework level there is an “inversion of control”, at the “library” level it is the “app” who decides where “control” is, and the “app” is where the “interaction” is. Without “interaction” there is only “web page”.

    5. OK, so what are the options to play along with Boostrap4 in Quasar? Quasar is based on “material design” and Boostrap is not, so why we even are talking about that? Because the most important are those designers/developers to convert and thousands of web page templates and snippets to use. We do not need to USE the B4 as a base for Quasar, we only need to have “possible way” to use hard learned B4 skills in Quasar environment. It is sufficient for Quasar not to prevent this (as it is doing now). Have it be done in Vue? Yes, there is a project MDBootstrap - “Material Design with Boostrap in Vue”:
      https://mdbootstrap.com/docs/vue/
      The name is perfect, becuase this project, as it is claiming, converted 800 000 developers to using Bostrap in Vue! This is the scale of traction we are talking about.

    6. How is it possible for this project to be this successful? It allowed to use B4 skills and promised to multiply the productivity by using Vue. This project is focused on presentation, which is Quasar weakness. If Quasar would incorporate some of the design elements/concepts/ideas from MDB, than because it is a superior FRAMEWORK 🙂 it would just offer a win/win.

    7. In essence - we really do not need to follow the path of manually dealing with every css typography property or scaling or visual specifics. It is Vue and it is 2019. The MDB project has something like “Sections”. Please take a look:
      https://mdbootstrap.com/docs/vue/sections/demo/
      This is what we (as “we” developers") need at the end of the day: the highly configurable web page compound elements, with superior layout, excellent typography, visually atractive and highly configurable sections of blog, contact, e-commerce, features, intros, magazines, projects, social, teams, testimonial, and of course, jumbotron. With those “bricks” the Quasar would not only be an excellent app platform but also web page platform. In MDB those sections are highly compatible with B4 semantics and this is why this project is so succesful at developer acquisition. In MDB they are manually converting those web templates and snippets (but it is possible and it is simple), in Quasar we just could write something to automatically convert existing B4/MDB templates/snippets (ideally of course).

    8. What am I proposing? There is a concept of App Extensions in Quasar. It is just ingenious. What we need in V1 is to not overwrite CSS classes from B4 (which would allow to use some of the B4 concepts) and make an App Extension with default sections for web page developers (maybe even the same as in MDB - they’re great). There is a twist - in specific demos, there should be examples of incorporating Quasar app components in those sections! It would be just a killer feature for thousands of developers. They couldn’t resist the temptation to finally use something app centric on those boring web pages, they are making every day, just to bring some food on the table.



  • @qyloxe Excellent post … very informative.

    The MDBootstrap stuff is awesome quality … beautiful looking …

    And … working out the financials on the number of users of it, and the fact it is a paid system, should give @rstoenescu some food for thought …

    However, we have to recognise that the Quasar team has limited resources … as @rstoenescu has already pointed out. It’s actually quite amazing what such as small team has already achieved …



  • Well, now I’m looking forward to RFS as an app extension. 😁

    Scott



  • @s-molinari Yes! And this is a way to go. Extensions are awesome!

    @digiproduct Regarding “limited resources” - that’s exactly why, it is questionable to build Quasars own CSS system for web pages (not apps) and I strongly opt, that in case of “designers” CSS just use, or better “allow” to use anything what designers are accustomed to.


  • Admin

    Sorry for changing the subject (but not by a lot):

    Just pointing out that Quasar is looking into the future and sets its own high and modern standards. And yes, in order to make progress in web development you need to break the current establishment. Otherwise we’d all be continuing to write websites in cgi-bin / perl today too, because maaany years ago that’s what developers were accustomed to. And what most developers are accustomed to at one point in time doesn’t actually mean it’s the best solution or the “definite” solution, and Quasar will never bend into choosing what we believe is not the optimal path to high quality work, not even over money.

    We now have limited resources, but if you take a look at what has been achieved here then imagine what we can do with proper resources. What I want to achieve with Quasar is to raise the bar for web development as a whole. Make it go forward, evolve. Change minds. Point out when there’s a better alternative.

    Giving a hint on what’s to come, since we’re on the subject of design. We are planning to launch a Quasar themes website and also teach people how easy it is to create custom Quasar v1.0 themes.



  • @rstoenescu said in fluid typography - SOLVED:

    Giving a hint on what’s to come, since we’re on the subject of design. We are planning to launch a Quasar themes website and also teach people how easy it is to create custom Quasar v1.0 themes.

    That’s excellent news … really looking forward to it.

    I really love everything that you’re doing with Quasar (hence why I became a Patreon) and I’m highly impressed by what you’ve achieved so far, and the awesome App Extensions that have started appearing … and the responsiveness of the team is simply amazing.

    The future looks very bright for Quasar …

    I just wish more Quasar users would help support the team … or at least write a nice comment over on your Medium article …

    https://medium.com/quasar-framework/why-donations-are-important-2f3f913cfc2e



  • @rstoenescu said in fluid typography - SOLVED:

    … Quasar is looking into the future and sets its own high and modern standards. And yes, in order to make progress in web development you need to break the current establishment. Otherwise we’d all be continuing to write websites in cgi-bin / perl today too, because maaany years ago that’s what developers were accustomed to. And what most developers are accustomed to at one point in time doesn’t actually mean it’s the best solution or the “definite” solution, and Quasar will never bend into choosing what we believe is not the optimal path to high quality work, not even over money.

    We now have limited resources, but if you take a look at what has been achieved here then imagine what we can do with proper resources. What I want to achieve with Quasar is to raise the bar for web development as a whole. Make it go forward, evolve. Change minds. Point out when there’s a better alternative.

    Please, please put above words somewhere on the main page. This is so strong, power and emotional narrative. Pure energy which leads and shows the new way to people. I’m in awe of those words, you used so many emotional and strong terms in such a short content. Almost like a poetry, but for developers 🙂 Please, use those words not only on this forum but for rest of the world to hear. They deserve it.



  • @rstoenescu 👏
    that’s great to hear and I’m happy to had decided using Quasar. I’m using it in a project which I’ve started with some guys. The more I use Quasar and feel more and more familiar with it, the more I love it.
    Although we yet don’t earn any penny with our project, I’ve decided to become a patreon. Just startet with the $10 monthly plan but surely will upgrade if we make the first turnover.

    The only reason I post this here, is the hope that other developers will think about spending $10 a month too. I’m convinced that’s totally worth it and only fair. Developers using Quasar should not risk that one day the Quasar-team might loose motivation. Being a little bit grateful is not the worst…



  • I just discovered that there are plans afoot for a comprehensive overhaul of Quasar’s responsiveness … and the team are looking for feedback about their plans …

    Head across to the Github page and leave your comments about their plans …

    https://github.com/quasarframework/quasar/issues/4274

    It certainly sounds as though the team are giving this matter very serious consideration and trying to provide us with the best possible solution …

    Others more knowledgeable than me should pitch in a give their feedback to assist the team on finalizing their plans …



  • Thank you all for your helpful posts, especially @qyloxe for detailded explanation. I personally like tachyons harmonious font scale. With rfs & https://type-scale.com/ it’s really easy to create any scale you want (and rest sure that rfs will make it responsive).



  • @kosirm That https://type-scale.com/ looks very interesting … thanks for posting that link.



  • On my box rfs is not working with q-markdown (quasar ext add @quasar/qmarkdown), which is fantactic extension. I’m totally new user (5 days of Quasar experience). Any idea, how can I make rfs to work with my markdown text?



  • For my curiosity, what is a “box rfs”?

    Scott



  • sorry i thought on my computer (win10, quasar 1.05, etc ) and rfs is https://github.com/twbs/rfs



  • @kosirm that RFS package looks very interesting



  • @kosirm - Got it. Thanks for the clarification.

    Scott



  • @digiproduct well I found it here on this page on @qyloxe explanation. But on the end of the day for me works better stylus function (thanks!!! @qyloxe). Forget about q-markdown, it was my mistake… I just needed to overwrite stuff in markdown.styl. Consider this solved 🙂



  • This is similar as @qyloxe code, just extended to other properties, so it can be used for padding, margin, etc.

    fluid-type($properties, $min-vw, $max-vw, $min-value, $max-value)
      for $property in $properties
        {$property} $min-value
      
      @media screen and (min-width: $min-vw)
        for $property in $properties
          {$property} "calc(%s + %s * ((100vw - %s) / %s)) !important" % ($min-value (remove-unit($max-value - $min-value)) $min-vw (remove-unit($max-vw - $min-vw)))
    
      @media screen and (min-width: $max-vw)
        for $property in $properties
          {$property} $max-value
    
    // Single property example
    :root
      fluid-type(font-size, 320px, 1920px, 16px, 24px)
    
    // Multiple property example
    h1
      fluid-type(padding-left padding-right, 320px, 1920px, 10px, 30px)
    

    Works for me… Props to Fredrik Beckius! There are also more sophisticated versions, for example to make different scales for different breakpoints



  • Since finding this post I’ve been fiddling round with dynamic fonts specifically on form fields.
    So sharing a bit what I have set up so far.

    First though for some reason if rfs-base-font-size is not explicitly set (even if to default) then the fonts don’t resize. Note I use a “factor” so I know it’s bigger which according to docs should enable the resizing.

    Secondly like @kosirm noted although useful it doesn’t adjust the related class properties (height, padding etc). That’s ok I suppose but the smaller font on smaller devices could have a smaller field box height saving precious vertical space and not look so wonky. Too classes like q-field__label need more bottom padding at smaller font size in order to keep the field content from running into the label.

    Too looks like instead of using padding the field box height is controlled by the height parameter of .q-field__control. So would have to be able to grab the computed font size in order to scale that number I suppose.

    Bottom line is that quasar at this point is agnostic to the dynamic font size. So if the framework wants to support dynamic font size then just need easy ways to scale all the related classes/properties when the font size changes. One idea would be that the framework has variables for font-size of various components/elements (e.g. q-field). Then you set that dynamically or manually (with defaults) instead of messing with classes directly. Guess those variables can be part of the component rather than in the core. Then all related can be changed accordingly. Nothing in the core variables like that except $input-font-size which gets ignored when wrapped in a field.

    @import "../../node_modules/rfs/stylus"
    
    // rfs settable variables - commented are defaults
    $rfs-base-font-size = 1.25rem
    // $rfs-font-size-unit = rem
    $rfs-breakpoint = 1400px
    // $rfs-breakpoint-unit = px
    // $rfs-factor = 10
    // $rfs-rem-value = 16
    $rfs-two-dimensional = true
    // $rfs-class = false
    
    $field-font-factor = 1.3
    $field-label-font-factor = 1
    
    .q-field__native
    .q-item__label
      rfs($rfs-base-font-size * $field-font-factor)
    
    .q-field__label
       &.no-pointer-events
         rfs($rfs-base-font-size * $field-font-factor)
    
    .q-field__label
       rfs($rfs-base-font-size * $field-label-font-factor)
       padding-bottom .3em // needs to be dynamic based on font size
    
    .q-field__control
       // height ??px // needs to be computed based on font size.  
    

Log in to reply