Exemplo n.º 1
0
        /// <inheritdoc />
        /// <summary>
        /// Applies the specified scalars
        /// </summary>
        /// <param name="w">Width scalar</param>
        /// <param name="h">Height scalar</param>
        public virtual void SetScalars(FontWidthScalar w, FontHeighScalar h)
        {
            // If both scalars are set to "keep current" then do nothing
            if (w == FontWidthScalar.NOP && h == FontHeighScalar.NOP)
            {
                return;
            }

            // Do not alter the scalars if param is set to x0 which means
            // "keep the current scalar"
            Width  = w == FontWidthScalar.NOP ? Width : w;
            Height = h == FontHeighScalar.NOP ? Height : h;

            byte wb = (byte)w;
            byte hb = (byte)h;

            byte[] cmd = (byte[])SetScalarCommand.Clone();

            cmd[2] = (byte)(wb | hb);
            internalSend(cmd);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Phoenix support normal and double scalars. All other scalar values will
        /// be ignored.
        /// </summary>
        /// <param name="w">New scalar (1x, 2x, nop)</param>
        /// <param name="h">New scalar (1x, 2x, nop)</param>
        public override void SetScalars(FontWidthScalar w, FontHeighScalar h)
        {
            var newWidth = Width;

            if (w == FontWidthScalar.NOP || w == FontWidthScalar.w1 || w == FontWidthScalar.w2)
            {
                newWidth = w;
            }

            var newHeight = Height;

            if (h == FontHeighScalar.NOP || h == FontHeighScalar.h1 || h == FontHeighScalar.h2)
            {
                newHeight = h;
            }

            // Only apply update if either property has changed
            if (newWidth != Width || newHeight != Height)
            {
                base.SetScalars(newWidth, newHeight);
            }
        }