Flutter: Courier has no Unicode support error - android-studio

I'm trying to use a font family NunitoSans & I have to modify a pre existing app. This is what the pubspec.yaml file looks like in terms of the font:
flutter:
fonts:
- family: NunitoSans
fonts:
- asset: fonts/NunitoSans-Regular.ttf
weight: 600
- asset: fonts/NunitoSans-ExtraLight.ttf
weight: 100
- asset: fonts/NunitoSans-Light.ttf
weight: 200
- asset: fonts/NunitoSans-SemiBold.ttf
weight: 700
- asset: fonts/NunitoSans-Bold.ttf
weight: 800
- asset: fonts/NunitoSans-ExtraBold.ttf
weight: 900
- family: OverpassMono
fonts:
- asset: fonts/OverpassMono-Regular.ttf
weight: 600
- asset: fonts/OverpassMono-Light.ttf
weight: 100
- family: AppIcons
fonts:
- asset: fonts/AppIcons.ttf
weight: 500
assets:
- assets/QR.svg
- assets/welcome_animation.flr
- assets/send_animation.flr
And this is how I'm trying to use the font. If I put anything other than fonts/NunitoSans-Regualar.ttf I get an error that this font is not present in the desired location.
final font1 = await rootBundle.load('fonts/NunitoSans-Regular.ttf');
final font2 = await rootBundle.load('fonts/NunitoSans-Regular.ttf');
Any help is appreciated. This is my full error (the link did not help me sorry):
Courier has no Unicode support see https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management
The font is not in my assets, its like this:
directory

fonts:
- family: Montserrat
fonts:
- asset: assets/fonts/Montserrat-Regular.ttf
- family: MontserratMedium
fonts:
- asset: assets/fonts/MontserratMedium-Medium.ttf
- family: MontserratLight
fonts:
- asset: assets/fonts/MontserratLight-Light.otf
- family: OpenSans
fonts:
- asset: assets/fonts/OpenSans-Regular.ttf
- family: Palatino
fonts:
- asset: assets/fonts/Palatino-Italic.ttf
In Widget use like this
TextStyle(
fontFamily: 'Montserrat',
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.w100,
//fontStyle: FontStyle.normal,
letterSpacing: 2,
);
TextStyle(
fontFamily: 'MontserratMedium',
color: Colors.white,
fontSize: 17,
letterSpacing: 0,
);

Related

React Native Elements rounded FAB

Im using React Native Elements, and I want a rounded FAB, but it shows a square FAB:
import { FAB } from 'react-native-elements';
<FAB
icon={{
name: 'add',
size: 30,
color: 'white',
}}
placement="right"
/>
How can I do that?
try adding buttonStyle={{borderRadius:1000,}}
<FAB
icon={{
name: 'add',
size: 30,
color: 'white',
}}
placement="right"
buttonStyle={{borderRadius:1000,}} />

Node.js - Get font properties description

Is it possible to access the Description part of a font properties, as shown when you right-click on the file?
Here, I'm interested in the Title attribute, for example.
I've used the get-file-properties package as described in Node JS - read file properties, but it doesn't seem to have access to it (it's using wmic behind the scenes, which doesn't return it either). For example, Title doesn't exist, and Description returns C:\\Windows\\Fonts\\Alegreya-Bold.ttf
Is there another way to access this information?
Thanks
As #RobinMackenzie mentionned, there's the ttfinfo package (https://github.com/trevordixon/ttfinfo), which will give you the info on a specific font in this form:
{
tables: {
name: {
'0': 'Copyright 2011 The Alegreya Project Authors (https://github.com/huertatipografica/Alegreya)',
'1': 'Alegreya',
'2': 'Bold',
'3': '2.003;HT ;Alegreya-Bold',
'4': 'Alegreya Bold',
'5': 'Version 2.003; ttfautohint (v1.6)',
'6': 'Alegreya-Bold',
'8': 'Huerta Tipografica',
'9': 'Juan Pablo del Peral',
'11': 'http://www.huertatipografica.com',
'12': 'http://www.huertatipografica.com',
'13': 'This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at: http://scripts.sil.org/OFL',
'14': 'http://scripts.sil.org/OFL',
'256': 'Roman numerals',
'257': 'Arrows, triangles and circles',
'258': 'Foundry icon',
'259': 'Dynamic arrows and triangles'
},
post: {
format: 2,
italicAngle: 0,
underlinePosition: 0,
underlineThickness: 0,
minMemType42: 16734720,
maxMemType42: 1509968640,
minMemType1: 1258291200,
maxMemType1: 0
},
'OS/2': { version: 4, weightClass: 700 }
}
}
A full list of the names (0, 1, 2,...) can be found here: https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids
There's also node-system-fonts (https://github.com/jgilsaa/node-system-fonts), which requires a build step as it's a C++ module, but on the plus side, gives you a lot of the same info, for every installed font:
[
{
path: 'C:\\WINDOWS\\FONTS\\ARIAL.TTF',
postscriptName: 'ArialMT',
family: 'Arial',
style: 'Regular',
weight: 400,
width: 5,
italic: false,
monospace: false
},
{
path: 'C:\\WINDOWS\\FONTS\\ARIALN.TTF',
postscriptName: 'ArialNarrow',
family: 'Arial Narrow',
style: 'Regular',
weight: 400,
width: 3,
italic: false,
monospace: false
},
{
path: 'C:\\WINDOWS\\FONTS\\ARIALI.TTF',
postscriptName: 'Arial-ItalicMT',
family: 'Arial',
style: 'Italic',
weight: 400,
width: 5,
italic: true,
monospace: false
},
...
]

Textstroke rendering problem with M letters

I have an echart with a serie type:'custom' and I have a rendering issues on the labels.
I return this
return {
type: 'group',
children: [
{
type: 'rect',
ignore: !rectNormal,
shape: rectNormal,
style: { stroke: '#707070' }
},
{
type: 'rect',
ignore: !rectText,
shape: rectText,
strokeLinejoin: "round",
stroke: 'trasparent',
strokeWidth: 0,
style: api.style({
fill: 'transparent',
fontWeight: bigText? 600 : 100,
fontSize: bigText? 15 : 10,
textStroke: '#707070',
strokeLinejoin: "round",
strokeLinecap: "round",
textStrokeWidth: 3,
text: text,
textFill: '#ffffff'
})
}
]
And it' rendered like this
As you can see the text stroke have problem in rendering the M letters and the strokeLinejoin and strokeLinecap did not solve the problem.
Do someone know how to fix this?
I solved it this way
{
type: 'rect',
ignore: !rectText,
shape: rectText,
strokeLinejoin: "round",
stroke: 'trasparent',
strokeWidth: 0,
style: api.style({
fill: 'transparent',
fontWeight: bigText? 600 : 100,
fontSize: bigText? 15 : 10,
textStroke: '#707070',
lineJoin: "bevel",
textStrokeWidth: 3,
text: text,
textFill: '#ffffff'
})
}

I have a problem adding an image to a flutter project

I am experimenting with a flutter web project (might not make a difference but worth mentioning), i want to add an image but i get an error every time i try,
I have added the right assets to the pubspec.yaml file and the files are in the folder.
i have tried restarting my ide, and flutter clean.
There was no change at all.
class _homePageState extends State<homePage> {
#override
Widget build(BuildContext context) {
var textStyle = TextStyle(
color: Colors.black,
fontSize: 30,
fontWeight: FontWeight.w100,
);
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
fontFamily: "MontSerrat"
),
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.grey[400],
title: Text("Example",
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w100,
),
)
),
body:
Container(
color: Colors.grey[400],
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset('assets/images/first_image.jpg')
],
),
)
),
);
}
}
the pubspec.yaml looks like:
name: epq_webapp
description: An app built using Flutter for web
environment:
# You must be using Flutter >=1.5.0 or Dart >=2.3.0
sdk: '>=2.3.0-dev.0.1 <3.0.0'
dependencies:
flutter_web: any
flutter_web_ui: any
dev_dependencies:
build_runner: ^1.4.0
build_web_compilers: ^2.0.0
pedantic: ^1.0.0
dependency_overrides:
flutter_web:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web
flutter_web_ui:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web_ui
flutter:
fonts:
- family: MontSerrat
fonts:
- asset: assets\fonts\montserrat\Montserrat-Regular.ttf
assets:
- assets/
- assets/images/first_image.jpg
i expect my code to display an image, however i get an error message,
Unable to load asset: assets/images/first_image.jpg
Flutter uses the pubspec.yaml file, located at the root of your project, to identify assets required by an app.
flutter:
assets:
- assets/my_icon.png
- assets/background.png
make sure you have your image in the assets directory
then
Widget build(BuildContext context) {
// ...
return DecoratedBox(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/background.png'),
// ...
),
// ...
),
);
//
}
You should get your image rendered
update your pubspec.yaml with this
`
fonts:
- family: MontSerrat
fonts:
- asset: assets\fonts\montserrat\Montserrat-Regular.ttf
uses-material-design: true <--- line added ---
assets:
- assets/
- assets/images/first_image.jpg
you could also check this it might help you out
I solved my problem by putting the assets under the web folder instead of the root of the project. then used
Image.asset(filename)
to display them.
Pubspec.yaml should be like:
flutter:
uses-material-design: true
assets:
- assets/images/
Code Snippet:
Center(
child: Image.asset(
'assets/images/account.png',
width: heartbeatAnimation.value,
height: heartbeatAnimation.value,
),
)
Output:

Interspace between text Lines in React native

I need to change the space between lines in a text in a React Native for both android and iOS.
This is the code in the styles pages:
text: {
color: '#C0C0C0',
fontSize: 18,
textAlign: 'justify',
}
Use lineHeight -
text: {
color: '#C0C0C0',
fontSize: 18,
textAlign: 'justify',
lineHeight: 30,
},
You can use
{'\n'}
inside your Text tag
example :
<Text>{'\n'} Heading : </Text>

Resources