endroid / qr-code

QR Code Generator
https://endroid.nl
MIT License
4.45k stars 726 forks source link

How to change label font size #380

Closed adeelahmed233 closed 2 years ago

adeelahmed233 commented 2 years ago

I am not able to change font size of label. I am creating label without bundle. I did not find it in README. Here is the code I am using

use Endroid\QrCode\Color\Color; use Endroid\QrCode\Encoding\Encoding; use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow; use Endroid\QrCode\QrCode; use Endroid\QrCode\Label\Label; use Endroid\QrCode\Logo\Logo; use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin; use Endroid\QrCode\Writer\PngWriter;

$writer = new PngWriter();

// Create QR code $qrCode = QrCode::create(''.$data["realqrcode"].'') ->setEncoding(new Encoding('UTF-8')) ->setErrorCorrectionLevel(new ErrorCorrectionLevelLow()) ->setSize($qr_size_doc) ->setMargin($qrmargin) ->setRoundBlockSizeMode(new RoundBlockSizeModeMargin()) ->setForegroundColor(new Color($fr, $fg, $fb)) ->setBackgroundColor(new Color($br, $bg, $bb));

// Create generic logo $logo = Logo::create(DIR.'/logo.png') ->setResizeToWidth($qrlogosize);

// Create generic label $label = Label::create(''.$qr_label_doc.'') ->setTextColor(new Color($lr, $lg, $lb)) ->setFont(new NotoSans(20));

I am new to object oriented programming. I would appreciate if you could provide sample code for the bold line of code above.

endroid commented 2 years ago

Duplicate of https://github.com/endroid/qr-code/issues/379