freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Build errors with MSVC


From: Werner LEMBERG
Subject: Re: [ft-devel] Build errors with MSVC
Date: Thu, 23 Oct 2014 08:04:38 +0200 (CEST)

>> Anyways, since VC 2010 is a frequently used compiler, we have to
>> find a workaround.  Behdad, any ideas?
>
> I do not have the compiler but I would try braces around {the
> constants}. Then you can use it to initialize a temp array to
> transfer in the appropriate place at last.
>
> FT_Int params[] = CFF_CONFIG_OPTION_DARKENING_PARAMETERS;
>
> driver->darken_params[0] = params[0];
> driver->darken_params[1] = params[1];
> driver->darken_params[2] = params[2];

Unfortunately, if you use braces there is no possibility for the
clever *compile-time* check

  typedef int  static_assert_darkening_parameters[
    ( x1 < 0   || x2 < 0   || x3 < 0   || x4 < 0   ||
      y1 < 0   || y2 < 0   || y3 < 0   || y4 < 0   ||
      x1 > x2  || x2 > x3  || x3 > x4              ||
      y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) ? -1 : +1];

This code expands to the invalid

  typedef int static_assert_darkening_parameters[-1];

if one of the assertions is invalid.

Another suggestion is to simply have eight constants:

  CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1   500
  CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1   400

  CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2  1000
  CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2   275

  CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3  1667
  CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3   275

  CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4  2333
  CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4     0

John, does this work if you pass those values to
SET_DARKENING_PARAMETERS_0?


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]