How could we extend the NamedSize to get a larger text?
The below LOC gives out a large size but I would like to have a larger one and yet not hardcoded:
myLabel.TextSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
Thank you.
https://developer.xamarin.com/api/type/Xamarin.Forms.NamedSize/
MEMBER NAME DESCRIPTION
Default The default font size.
Large A Large font size, for titles or other important text elements.
Medium A default font size, to be used in stand alone labels or buttons.
Micro The smallest readable font size for the device. Think about this like legal footnotes.
Small A small but readable font size. Use this for block of text.
A larger font size does not exist in the NamedSize Enumeration. You could create a custom property MyFontSize and set it to a different value, based on the current device and have your label's size bound to that property.
It's still hard-coded, but you'd have to play around with size values to make it look the way you want on each device.
Related
I am using NextJS and react-pdf/renderer and my tool creates a PDF and I'd like to display it with the PDFViewer component.
The Viewer loads but only takes up a small part of the screen. Whenever I change the 'width' and 'height' attribute with relative values (100%, 100vh), it won't take it. The only way to force it, is to put specific pixel values in it, but that defeats the purpose of being responsive to the screen size.
Sandbox that reproduces my issue: https://stackblitz.com/edit/nextjs-su5bi1?file=pages/index.js
Does anyone have an idea why this is happening?
Here is your screen with a red block of pixels of 150 pels high, note how it matches exactly your frame height.
Generally you ONLY set frame height in pixel units (The cross browser default minimum is 150?) you probably need somewhere to set a style defining the height as a different number of pixels.
see comment 2 in https://stackoverflow.com/a/73201090/10802527
Label in CN1 is limited to being a Single line.
Now that we have to use SpanLabel for anything that can take more than 1 line,
we face one issue.
When we have a strict design that uses consistent height for a list item, we have to give max/min lines allowed for the SpanLabel (At least that's how it works in Android And Flutter).
When I searched for anything that says line in SpanLabel file, I only found that word in one place, that too in a comment.
It did not feel right using fixed height/width property to a SpanLabel as they will vary with fonts and font sizes. The hight should be calculated with respect to the number of lines of the text & font config like font size, line spacing, padding, etc.
What is the right way to achieve consistent height across various SpanLabel despite the varied length of the text they display?
The "right way" would be the layout manager as it would allocate the right amount of space to the span label and everything else. E.g. if you use TableLayout you can allocate the height as percentage.
SpanLabel is technically a TextArea that's encapsulated. It has that distinction between rows/lines which isn't exposed within SpanLabel. But you can manipulate the underlying text area by using getTextComponent().
I have built an automatic report in RMarkdown. The problem is that images in this report can have varying size and therefore the relative size of the element inside changes based on the number of items in the axis:
(ok in this case the two images are totally different but it is just to show what I mean)
Is there a way to fix only some parameters, like resolution, or just one dimension, let the other dimension to vary according to the elements in order to keep the element size fixed?
Thanks
The resulting icon is oversized, even with font-size set to 16px, it looks like 32px or even more.
I used the [Octicons][2] approach to build the icons, so Glyphs setup looks as follows:
Units per Em is 2048
Metrics is exactly like Octicons
Glyph width is set to 2048
Grid spacing is set to 32
My mistake was to create glyphs with setting of "units per em" equal to 1000. After changing the value, already existing glyphs do not update automatically, you should press the button next to the setting.
How can I autoscale the text font size in a web page in order to make text in a div or p fit within given bounds?
There are nice solutions for Android, like this one, but I haven't found any for GWT.
Do you guys have any?
Thanks!
There are sevaral solutions to this problem:
(1) render the text, measure its width (myLabel.getOffsetWidth(), compare to the desired width, change font size if it does not fit and start over (remember to do this inside the Scheduler's deferred command, or your offset width will be zero);
(2) use FitText.js (http://fittextjs.com/);
(3) use canvas which can auto-fit text into provided space;
(4) use ellipsis when text overflows;
(5) use viewport units for text font (limited browser support at this time): http://css-tricks.com/viewport-sized-typography/
(6) create a different, more fluid UI design that handles content size better.