'I want to use custom font in Flutter Image.drawString
This is about Flutter, Dart, Image, specifically drawString function.
First of all, what I am trying to do is watermark the picture taken with the address and time. I mean not just placing text over the image but actually merge it with picture so that the user can submit the picture as a proof that he's done a certain task in the right spot and right time.
To do so. I found the right function drawString(), but the problem is it only supports arial font. Since I have to write in Korean, I need to use my own font. Is there any one who tried this before. I tried readFont method but couldn't make it. Anyone who knows?
import 'package:image/image.dart' as img;
img.drawString(image1, img.readFont('My OWN Font', image1), 30, 30, str_to_write, color:0xFF000000);
====================================== before I call the function, I tried to make the bitmap font like this as stated in the Image package, but failed to make it. (So, I placed the zip file in the same directory and also in the assets folder)
String fileName = 'GmarketSansTTFMedium.ttf.zip';
File file = File('$fileName');
List<int> bytes = file.readAsBytesSync();
print(bytes);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|