SceneBuilder JavaFX Font size Scaling - javafx

I can't seem to figure out how to scale the font to the size of the window. Using normal responsive CSS sizes like 3em doesn't work (it stays the same size).
I know how to make it work if there was no FXML involved, but I can't figure out how to interact with any CSS or FXML variables from Java.

Related

Should root element font size affect elements other than text?

Learning about rem and try to make whole website responsive.
According to the value of 1rem, should I be scaling:
Font sizes and margins/paddings around text
margins/paddings/size of elements that do not directly contain text like components and images
Does this depend on the layout?
For example, I have an image in a card component. As user increases the font size, image or space around it might stay small next to a larger font.
Should I let this happen or scale image with the font size? I know the setting in the browser only changes font size. On Facebook, for instance, font size from browser settings does not affect the images or component sizes.
Should I then only worry about text?
I think this is entirely based on context/preference but,
Generally yes, if you are using 'em' for padding/margin (which you should be) this will scale automatically however to the font-size of its element.
Depends on the element, text is hard to read for some people as its small lines in unique shapes so this makes the most sense to scale however images and other elements are generally a lot easier to look at. - if the content of the element is something like an icon for button I would probably scale it with text as it is likely to be adjacent to some text so would look weird if the text scaled but the element didn't. Otherwise I would just use responsive web design such as flex/grid to fill the space of a page, this is "scaling" however less for accessibility and more for design.

Figma's dimension pixel for pixel in CSS

When converting Figma design to HTML and CSS, do you copy the Figma's dimension pixel for pixel in CSS...
Anytime I copy the dimension pixel for pixel, it's either too small or too big but not far from what it's meant to look like.
Any tips on how to go about this? Thanks
Pixel dimensions in Figma and pixel dimensions in CSS should be the same.
Probably when designing, you're viewing the design only in Figma editor. Due to zoom in/out of the design file, you're not seeing how it will look in an actual device.
For example, you put font-size: 36px for a and your design is zoomed out 50%. You will notice 36px is looking very small in the design. But when you add that into CSS and run it in the browser it looks good.
I would suggest always preview your design on a real device. Run the prototype in a browser for the desktop apps. And for previewing mobile apps use Figma mobile. I believe you'll figure out your issue.

Is there a way to set the default zoom for bootstrap

I bought a bootstrap 4 admin theme but its sizing (fonts, spacing, images) for desktop is to large was the feedback I got from client.
However if I change the zoom to 70% the sizing of all the elements is exactly what I need.
I want to make the 70% zoom default in the css for desktops but that only keeps it for my browser on my computer. Is there a css setting or other setting that allow me to do it for all computers.
Since the base theme will get updated by the original auhtor often
I have tried changing the css - font size, spacing, image sizes on so many CSS elements but surely there should be an easy way to simulate make it 70%.
You can adjust the css styles of your elements to fit the purpose.
Have a look at the current value and multiply them with 0.7
If the sizing is defined in rem you can just change the html sizes for the content to fit as rem is aquivalent to the sizes of the html wrapper

Viewport-responsive div dimensions and font size?

I'm working on a website over here:
venuslabs.org
Some of the tabs, such as "Technology Details (pdf)" and "Venus Needs Advocates (Take Part!)" create a number of subwindows in the middle. Their sizes are based on em, so that they scale properly if the user changes their font size / zoom level (as I understand is "best practices" today).
The way they are looks fine... most of the time. But when viewed on a cell phone in horizontal (not vertical) layout, they're just too big and overlap the top bar. So it appears that the current layout is fine down to a certain height, but below that height I need to have the font size scale linearly with page height (with the subwindows scaling along with the font size).
Obviously I could do that with javascript, but I know you're supposed to do things in pure CSS where possible. What would be the recommended approach? I've been trying a number of things and none have really played out.

Qt: Font size or rather height

I have a fixed strip I'm drawing, 50 pixels in height and as wide as my application main window.
I'd like to place text on that strip.
My problem is that even with the same font and size (arial 15 for example), the font will have a different height under OSX and Windows.
Is there a way to make this more predictable? I know I can use the QFont measuring mechanism until the extent of the text I need will match my target projection area, more or less. but is there another way to set size that'll be identical across operating systems? Just want to make sure I'm not missing something here.
You can specify font heights in pixels using QFont::setPixelSize(). It's particularly handy when drawing text over fixed sized bitmaps.

Resources