Skip to content

Title options for position 'center' | 'left' | 'right' #44

Description

@yogithesymbian

request

could you addded options for title position
in my case i have long title and i added \n but the result

example :

unExpected result title

lorem ipsum
lorem ipsumlorem ipsum

expected result title center for title

           lorem ipsum
lorem ipsumlorem ipsumlorem ipsumlorem 

i see the default

if (_htOption.title) {
            _oContext.fillStyle = _htOption.titleBackgroundColor;
            // _oContext.fillRect(0, 0, t._canvas.width, _htOption.titleHeight + this._htOption.quietZone);
            _oContext.fillRect(_htOption.quietZone, _htOption.quietZone, _htOption.width, _htOption.titleHeight);

            _oContext.font = _htOption.titleFont;
            _oContext.fillStyle = _htOption.titleColor;
            _oContext.textAlign = 'center';
            _oContext.fillText(_htOption.title, t._canvas.width / 2, _htOption.quietZone + _htOption.titleTop);
        }

but dunno why my result not center

here is my config

var config3 = {
    text: `${text}`,
    width: 400,
    height: 400,

    // QuietZone
    quietZone: 100,
    quietZoneColor: 'rgba(0,0,0,0)',

    title: title, // Title
    titleFont: 'normal normal bold 30px Arial', // Title font
    titleColor: '#004284', // Title Color
    titleBackgroundColor: '#ffffff', // Title Background
    titleHeight: 90, // Title height, include subTitle
    titleTop: 0, // Title draw position(Y coordinate), default is 30

    // // === SubTitle
    subTitle: subTitle,
    subTitleFont: 'normal normal bold 16px Arial', // Subtitle font
    subTitleColor: '#269926', // Subtitle color
    subTitleTop: 55, // Subtitle drwa position(Y coordinate), default is 50

    logo: logoURL, // LOGO

    onRenderingStart: function (options) {
      winLogger.info(`The QRCode file was created. by`)
    }
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions