Default UIFont size and weight but also support preferredFontForTextStyle











up vote
2
down vote

favorite












If I have my own group of UIFonts with different sizes and weights, for example:



let customFont03 = UIFont.systemFont(ofSize: 40, weight: .thin)


How can I support Dynamic Type while still preserving my custom size and weight as a default standard and scaling that depending on how the user selects accessibility sizes?



I'm not sure that preferredFont(forTextStyle:) is what I want because it only accepts a UIFont.TextStyle and I don't want to lock customFont03 in as a .body or .headline etc...










share|improve this question






















  • What traits do you want to keep from the preferredFont and what traits do you want to override with your own setup?
    – rmaddy
    Nov 17 at 23:27










  • I want size 40 and weight thin to be the default, but if the user changes the settings to anything other than the default the weight and size will scale appropriately.
    – Turnipdabeets
    Nov 17 at 23:29















up vote
2
down vote

favorite












If I have my own group of UIFonts with different sizes and weights, for example:



let customFont03 = UIFont.systemFont(ofSize: 40, weight: .thin)


How can I support Dynamic Type while still preserving my custom size and weight as a default standard and scaling that depending on how the user selects accessibility sizes?



I'm not sure that preferredFont(forTextStyle:) is what I want because it only accepts a UIFont.TextStyle and I don't want to lock customFont03 in as a .body or .headline etc...










share|improve this question






















  • What traits do you want to keep from the preferredFont and what traits do you want to override with your own setup?
    – rmaddy
    Nov 17 at 23:27










  • I want size 40 and weight thin to be the default, but if the user changes the settings to anything other than the default the weight and size will scale appropriately.
    – Turnipdabeets
    Nov 17 at 23:29













up vote
2
down vote

favorite









up vote
2
down vote

favorite











If I have my own group of UIFonts with different sizes and weights, for example:



let customFont03 = UIFont.systemFont(ofSize: 40, weight: .thin)


How can I support Dynamic Type while still preserving my custom size and weight as a default standard and scaling that depending on how the user selects accessibility sizes?



I'm not sure that preferredFont(forTextStyle:) is what I want because it only accepts a UIFont.TextStyle and I don't want to lock customFont03 in as a .body or .headline etc...










share|improve this question













If I have my own group of UIFonts with different sizes and weights, for example:



let customFont03 = UIFont.systemFont(ofSize: 40, weight: .thin)


How can I support Dynamic Type while still preserving my custom size and weight as a default standard and scaling that depending on how the user selects accessibility sizes?



I'm not sure that preferredFont(forTextStyle:) is what I want because it only accepts a UIFont.TextStyle and I don't want to lock customFont03 in as a .body or .headline etc...







ios swift accessibility






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 17 at 23:25









Turnipdabeets

1,73021229




1,73021229












  • What traits do you want to keep from the preferredFont and what traits do you want to override with your own setup?
    – rmaddy
    Nov 17 at 23:27










  • I want size 40 and weight thin to be the default, but if the user changes the settings to anything other than the default the weight and size will scale appropriately.
    – Turnipdabeets
    Nov 17 at 23:29


















  • What traits do you want to keep from the preferredFont and what traits do you want to override with your own setup?
    – rmaddy
    Nov 17 at 23:27










  • I want size 40 and weight thin to be the default, but if the user changes the settings to anything other than the default the weight and size will scale appropriately.
    – Turnipdabeets
    Nov 17 at 23:29
















What traits do you want to keep from the preferredFont and what traits do you want to override with your own setup?
– rmaddy
Nov 17 at 23:27




What traits do you want to keep from the preferredFont and what traits do you want to override with your own setup?
– rmaddy
Nov 17 at 23:27












I want size 40 and weight thin to be the default, but if the user changes the settings to anything other than the default the weight and size will scale appropriately.
– Turnipdabeets
Nov 17 at 23:29




I want size 40 and weight thin to be the default, but if the user changes the settings to anything other than the default the weight and size will scale appropriately.
– Turnipdabeets
Nov 17 at 23:29












1 Answer
1






active

oldest

votes

















up vote
0
down vote













The default standard text style is .body so, if you want to preserve your custom size as the default standard while supporting the Dynamic Type, you should define and adapt the keys fontName and fontSize to your custom size in a style dictionary.



Using the Dynamic Type means using the text styles. If you want specific font, you must define it in a native text style so that it's perfectly and automatically handled by the system.



I suggest you take a look at this great "useYourLoaf" article and at this useful accessibility site.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53356530%2fdefault-uifont-size-and-weight-but-also-support-preferredfontfortextstyle%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    The default standard text style is .body so, if you want to preserve your custom size as the default standard while supporting the Dynamic Type, you should define and adapt the keys fontName and fontSize to your custom size in a style dictionary.



    Using the Dynamic Type means using the text styles. If you want specific font, you must define it in a native text style so that it's perfectly and automatically handled by the system.



    I suggest you take a look at this great "useYourLoaf" article and at this useful accessibility site.






    share|improve this answer



























      up vote
      0
      down vote













      The default standard text style is .body so, if you want to preserve your custom size as the default standard while supporting the Dynamic Type, you should define and adapt the keys fontName and fontSize to your custom size in a style dictionary.



      Using the Dynamic Type means using the text styles. If you want specific font, you must define it in a native text style so that it's perfectly and automatically handled by the system.



      I suggest you take a look at this great "useYourLoaf" article and at this useful accessibility site.






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        The default standard text style is .body so, if you want to preserve your custom size as the default standard while supporting the Dynamic Type, you should define and adapt the keys fontName and fontSize to your custom size in a style dictionary.



        Using the Dynamic Type means using the text styles. If you want specific font, you must define it in a native text style so that it's perfectly and automatically handled by the system.



        I suggest you take a look at this great "useYourLoaf" article and at this useful accessibility site.






        share|improve this answer














        The default standard text style is .body so, if you want to preserve your custom size as the default standard while supporting the Dynamic Type, you should define and adapt the keys fontName and fontSize to your custom size in a style dictionary.



        Using the Dynamic Type means using the text styles. If you want specific font, you must define it in a native text style so that it's perfectly and automatically handled by the system.



        I suggest you take a look at this great "useYourLoaf" article and at this useful accessibility site.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 18 hours ago

























        answered yesterday









        XLE_22

        28437




        28437






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53356530%2fdefault-uifont-size-and-weight-but-also-support-preferredfontfortextstyle%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python