Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yogithesymbian opened this issue Oct 14, 2024 · 0 comments
Open

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

yogithesymbian opened this issue Oct 14, 2024 · 0 comments

Comments

@yogithesymbian
Copy link

yogithesymbian commented Oct 14, 2024

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`)
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@yogithesymbian and others