I'm trying to use a custom font in appcelerator alloy framework.
I have the following files:
header.tss
".headerButtonLabel": {
color: '#5d5d5d',
shadowOffset: {x: 1, y: 1},
shadowColor: '#ffffff',
font: {fontSize: 18, fontFamily: 'Helvetica Neue LT Std 77 Bold Condensed'},
textAlign: 'left'
}
header.xml
<Button class="headerButton">
<Label class="headerButtonLabel" text="Text button here"></Label>
</Button>
tiapp.xml
<ios>
<plist>
<dict>
<key>UIAppFonts</key>
<array>
<string>fonts/HelveticaNeueLTStd-Bd.otf</string>
<string>fonts/HelveticaNeueLTStd-BdCn.otf</string>
<string>fonts/HelveticaNeueLTStd-Roman.otf</string>
</array>
</dict>
</plist>
</ios>
Fonts are stored in app/assets/fonts
I've attached those fonts here
When I'm opening HelveticaNeueLTStd-BdCn.otf, it appears with the following name Helvetica Neue LT Std 77 Bold Condensed.
Am I missing something?
Figure it out after all.
example image of where you will find the right name
It seems that PostScript name from font book is the right name when you develop for IOS.
Related
I'm trying to fit an image into Vuetify's VBtn component, like this-
<template>
<v-btn>
<img class="img-in-btn" src="#/assets/my-image.png">
</v-btn>
</template>
If I use the v-img and do it like-
<v-img :src="my-img" height="100%" width="100%" />
It still results in a very wide button and a huge image.
My current attempt is to grab VBtn's dimensions directly from Vuetify's stylesheet, and apply it directly to image class selector like this-
<style lang="scss" scoped>
#import '~vuetify/src/components/VBtn/_variables.scss';
.img-in-btn {
height: $btn-sizes;
object-fit: contain;
}
</style>
But this throws an error-
SassError: ("x-small": 20, "small": 28, "default": 36, "large": 44, "x-large": 52) isn't a valid CSS value.
What's the proper way of doing this?
As mentioned in the documentation, $btn-sizes is configured using the map-deep-merge, like this-
map-deep-merge(
(
'x-small': 20,
'small': 28,
'default': 36,
'large': 44,
'x-large': 52
),
$btn-sizes
);
It means $btn-sizes has multiple mapped values that can not be assigned directly to any CSS property and this is why you are getting the error.
Now, to get the default key's value use, map-get function like this-
map-get($btn-sizes, "default")
Here is the complete example-
<style lang="scss" scoped>
#import "~vuetify/src/components/VBtn/_variables.scss";
.img-in-btn {
height: map-get($btn-sizes, "default") + px !important;
}
</style>
So I can't seem to get html to rotate with react-three/drei without it being extremely blurry. It won't blur at smaller sizes, but whenever I add more text it reaches a point where it just blurs up like below.
If there's a more standard way to rotate an html container, please let me know and i'll just that because i'm losing my mind here.
Code:
<Html
as="div"
position={[0, 0, 0]}
rotation={[0, 0.4, 0]}
transform
style={{
backgroundColor: "green",
borderRadius: 4,
}}
>
<div>
{"Testingsss"}
</div>
...
</Html>
Without rotation:
With rotation:
Following is my code
<TouchableOpacity style={{backgroundColor: 'pink', height: 100, width: 100}} activeOpacity={0.5} onPress={() => console.log('On Press'}>
<Image source={} style={{height: 50, width: 50, borderRadius: 25} imageType ={'profilePhoto'}/> />
</TouchableOpacity>
TouchableOpacity's size is bigger than theImage. If I touch outside of Image then onPress is working. But If I touch over the Image then onPress is not firing.
This is happening only in iOS. Working as expected in Android. I am using RN0.63
Am I missing anything here?
It seems that you are using an unofficial Image component. Any nested Touchable or other gesture component in it will affect your click results.
Try to use the official Image component. Or read the docs of the component you are using. It may has its own onPress event.
I'm using react-bootstrap button and fortawesome/react-fontawesome for the icon. I'm setting the button height and width using this code
#button-size{
height: 1vh;
width: 1vw;
}
then I'm inserting the icon inside the button using this code
<Button id="button-size">
<FontAwesomeIcon icon={faFacebookF} />
</Button>
but my problem is the icon goes outside of the button. How can I center the icon inside the button
Using viewport measurements for height and width on the Button to control its size won't work well in this setup especially when you are using font icons (also, apparently, in the library you are using they generate the output as svg). I suggest you control the size of the button through padding or pixel measurements.
Example:
#button-size {
padding: 6px 20px;
}
In addition, If you need to adjust the size of the font icon you can do that using the size prop or you can use CSS font-size
<Button id="button-size">
<FontAwesomeIcon icon={faFacebookF} size={"5x"}/>
</Button>
CodeSandBox: https://codesandbox.io/s/angry-drake-5pexo?file=/src/App.js
If you absolutely must use the viewport measurements on your project, which I highly discourage, you can opt to assign position-relative to the button and style the font-icon component as necessary to center.
Example:
export default function App() {
const customFontIconStyle = {
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)"
};
return (
<Container>
<Button id="button-size" className="position-relative">
<FontAwesomeIcon icon={faFacebookF} style={customFontIconStyle} />
</Button>
</Container>
);
}
I have svg image with this attributes: viewBox="0 0 100 100"
This is basic code which I use for displaying svg:
Image{
width: 50
height: 50
source: "test.svg"
}
and it's not ok because image is rasterized before resizing to width and height values(50,50).
This code works perfect on all resolution:
Image{
width: 50
height: 50
sourceSize.width: width
sourceSize.height: height
source: "test.svg"
}
because image is drawn in exact dimensions which is needed!
Is it possible to get same functionality in a TextEdit where <img> tag is used?
<img src="test.svg" width="50" height="50">
This code doesn't work because sourceSize can't be set... and image is rasterized before resizing and displaying...
Maybe there is some other way to accomplish this?
The only solution is to provide the image size as part of the image url, and reimplement QTextDocument::loadResource or QTextEdit::loadResource in a derived class. Your image element would then look like:
<img src="test.svg?50x50" width="50" height="50" />
You can parse the url in your implementation of loadResource.