code: protected Float pxLength(TermLength spec)
      {
          float nval = spec.getValue();
          TermLength.Unit unit = spec.getUnit();
          
          switch (unit)
          {
              case pt:
                  return (nval * dpi) / 72.0f;
              case in:
                  return nval * dpi;
              case cm:
                  return (nval * dpi) / 2.54f;
              case mm:
                  return (nval * dpi) / 25.4f;
              case q:
                  return (nval * dpi) / (2.54f*40f);
              case pc:
                  return (nval * 12 * dpi) / 72.0f;
              case px:
                  return nval;
              case em:
                  return em * nval;
              case ex:
                  return ex * nval;
              default:
                  return null;
          }
      }
docs: Converts a length from a CSS length to 'px'.
  @param spec the CSS length specification
  @return the length in 'px' or {@code null} when the unit is invalid