Hi all,

     :set guifont=Andale_Mono:h7.5:w4.5
> +    :set guifont=Cascadia_Code:h14:fss19=1:fcalt=1:fliga=1
>


I don't see any tests for this code change. That may be hard or
impossible...

+               // Add default features, skipping any that the user
> +               // has explicitly specified (either + or -).
> +               for (int d = 0; d < numDefaults; ++d)
> +               {
> +                   int overridden = 0;
> +                   for (int u = 0; u < mFontFeatureCount; ++u)
> +                   {
> +                       if ((DWRITE_FONT_FEATURE_TAG)mFontFeatures[u].tag
> +                               == defaultFeatures[d].nameTag)
> +                       {
> +                           overridden = 1;
> +                           break;
> +                       }
> +                   }
> +                   if (!overridden)
> +                       typography->AddFontFeature(defaultFeatures[d]);
> +               }
>


This is a loop in quadratic time. Not sure how to solve it...

>
+#if defined(FEAT_DIRECTX)
> +    // Parse font features from guifont (e.g.,
> ":fss19=1:fcalt=0:fliga=1").
> +    {
> +       DWriteFontFeature features[DWRITE_MAX_FONT_FEATURES];
> +       int                 feat_count = 0;
> +       char_u              *fp;
> +
> +       if (font_name != NULL)
> +       {
> +           // Find each ":f" option in font_name.
> +           for (fp = font_name; *fp != NUL; fp++)
> +           {
> +               if (*fp == ':' && *(fp + 1) == 'f')
> +               {
> +                   char_u tag[5];
> +                   int    ti = 0;
> +                   unsigned int param = 1;
> +
> +                   fp += 2;  // skip ":f"
> +                   while (*fp != NUL && *fp != '=' && *fp != ':'
> +                           && ti < 4)
> +                       tag[ti++] = *fp++;
> +                   tag[ti] = NUL;
> +
> +                   if (ti != 4)
> +                       continue;  // invalid tag length
>


The '5' and '4' in the code above are better defined as constants or as a
#DEFINE (now they are just magic numbers...)

+
> +                   if (*fp == '=')
> +                   {
> +                       fp++;
> +                       param = (unsigned int)atoi((char *)fp);
> +                       while (*fp >= '0' && *fp <= '9')
> +                           fp++;
> +                   }
> +
>

Would this correctly work for tags with either a large value
(:fss19=99999999999) or an (invalid) negative one (:fss19=-)?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/CA%2BOt1OwekBBj8%2BtCGOH25eWsEwGF6R05-cNAhoTkpEdrCJpEow%40mail.gmail.com.

Raspunde prin e-mail lui