I have an SVG image (logo) that contains SVG text element. I want to provide users with ability to change font of the text via list UI (drop down list), so that if user clicks the drop down list they can see how will this text look like approximately after selection. If selected such font attributes would apply to the SVG text element.
Right now I feel like I don't understand how would I learn for a particular user's browser/system which fonts are available.
I read SVG fonts specs and it is still confusing.
One approach I found is:
- I pre-bake the list based on assumptions (lets say we list all popular fonts)
- show this list to user who could see on their own whether the applied font is looking good for them
- If users selects an option that is not supported by their system - it will be matched by closest "equivalent" font (according to the specs)
But this is suboptimal as I want to guarantee what this user will generate as SVG logo will look the same for all other users.
Then I was thinking to embed the fonts I liked from fonts.google.com into my web-site and list those?
So given the description and requirements to make the font choice consistent across many users - what should be my approach?
Related
I have two specific and several more general questions which are all related to the availability of documentation for material theming in Android.
The general questions are the result of the specific questions.
According to the official docs [1], [2], [3], [4] and blogs [5], [6], [7] about Android Material Theming one should adopt the following theme values for branding
colorPrimary
colorPrimaryVariant
colorOnPrimary
colorSecondary
colorSecondaryVariant
colorOnSecondary
Those are also the values which are preset when one creates a new Android project with the wizard.
According to [2] one should use the Material Color Tool to pick colors, check the colors in various previews and also assess their accessibility, in particular their legibility.
After one has chosen a primary and secondary color, the tool automatically recommends a matching text color as well as a darker and lighter variant for each color.
The problems starts, when one exports the chosen colors to an android XML file.
(The link is in the upper right corner of the Tool).
The exported values are named
primaryColor
primaryLightColor
primaryDarkColor
secondaryColor
secondaryLightColor
secondaryDarkColor
primaryTextColor
secondaryTextColor
Obviously, there is a mismatch in the number and names of the attributes between what the theme expects and what the color tool exports.
Moreover, according to [6] and [8] the primary and secondary color (colorPrimary, colorSecondary) are supposed to be used as background colors (for certain elements of the UI) with foreground elements (such as text) printed on top of them (using colorOnPrimary and colorOnSecondary, resp.).
Also, [6] tells us that the secondary color should preferably be a bright complement to the primary color.
Hence, I decided for a light yellow on which black text is perfectly legible.
However, I had to find out that androidx.preference.PreferenceFragmentCompat uses the secondary color (colorSecondary) as the foreground color of the caption of preference groups on a background which is colored with colorBackground which equals white.
Obviously, a bright yellow on white background is anything but legible.
This leads me to my first two, specific questions
Question 1: How are the colors of the Material Color Picking tool supposed to be mapped onto the theme attributes?
Question 2: Is it correct that the primary and secondary color are also used as text colors on surface background or is this simply a bug in the style used by PreferenceFragmentCompat for captions?
This surprising experience led my to more general questions.
According to the official docs and my understanding views and in particular widgets are governed by styles, e.g. TextAppearance.MaterialComponents.Caption for a TextView which is used as a caption.
These styles do not assign specific values to the attributes which they define, but refer to "semantic" values which act as a placeholder such as colorPrimary and which are defined by a theme.
Then the theme assigns specific values to these semantic values, possibly using another step of indirection, e.g. by referring to named colors.
Assigning custom values to the semantically named values of a theme is supposed to be the main anchor point to adopt a theme like Theme.MaterialComponents.DayNight without the need to redefine all individual styles separately.
However, more or less by accident, I found the styles for TextView such as TextAppearance.MaterialComponents.Caption, TextAppearance.MaterialComponents.Body1.
Again, more or less by accident, I found the theme attributes colorSurface, colorError, colorBackground.
They are listed in the blog 6.
This leads to the following general questions
Question 3: Is there any reference which completely lists all styles which are already defined in by the material design library and explains
what purpose they serve
in which context they should be applied to views (aka widgets)
which subclass of View the style supports (i.e. a edit field, a radio button, etc.)
which semantic attributes of a theme the style uses for what part
Question 4: Is there any reference which completely list all semantic values which are defined by the material design library and explains
their type (i.e. a color, a font size, a dimension)
their intended purpose (e.g. should be light background color)
how they are supposed to interact with other semantic values (e.g. should contrast with color xyz, should be at least be larger than the double of size xyz)
I am thinking of a reference like a typical reference for an API.
I am not looking for the 1000th blog article which again recaps the basic attributes from above.
I already had a look at https://material.io/, but it seems that there is no such thing.
he following banner is an example of what i want:
https://top.gg/api/widget/535064930727100427.svg
https://top.gg/api/widget/698275428976164945.svg
It's automatically generated and contains dynamic text which causes the "background color" to automatically adjust its size to it as well as have a border radius.
The text and shapes are all paths when I look at the source.
I would like to know how this has been accomplished as SVG itself does not support a dynamic border radius and background color by default.
Somewhere in the SVG source of the links above it showsid="surface19" and I did some research to see what piece of software or library provides such ID's. The text also seems to automatically be converted to paths, so it's not a hand-written SVG that gets modified programmatically from what it seems.
I did a lot of research before asking this question.
I have been making my own webfont taking as a starting point articles from web designer depot and intridea.
I know different engines render fonts differently and but the issue I'm having is that firefox renders the font higher than chrome - at the size I am displaying the font this is very noticeable (3 or 4 px - which on a button means they're totally misaligned).
I have also referenced Github's octicon documentation - when checking out how octicons compare browser they look great! No noticeable difference as far as I can see. How did they achieve this?
I am using inkscape and have tried a couple of different svg starter templates. Setup is Set width: 1024 and have tried the icons at various sizes with no different outcome. i.e. 512pt square and aligned just under the baseline.
My question is what rules do I need to impliment when creating a webfont to get the smallest difference between browser rendering of the font?
This is a complicated question that involves something called vertical metrics. A font has three sets of these. the first set, found in the 'hhea' table, are generally specific to Mac. The other two sets, found in the 'OS/2' table relate to Windows (and Linux). The idea is to get these values equalized. Our Generator has a feature called oddly enough 'Fix Vertical Metrics' which does a best guess at these. Note that Github used the Generator for finishing their icons.
I know this doesn't relate specifically to SVG fonts, but I'm pretty sure this is where your problems lie. Having different vertical metrics values screws up the baselines across platforms.
Some reading:
http://blog.typekit.com/2010/07/14/font-metrics-and-vertical-space-in-css/
http://webfonts.info//webfonts-know-how/part-1-we-need-talk-about-line-height
http://code.google.com/p/googlefontdirectory/wiki/VerticalMetricsRecommendations
There's a webapp, icomoon : http://icomoon.io/app/
It make the job pretty well but you have to test the rendering of the different icons.
They offert a lot of icons if you don't want do design everything.
I had the same problem, and solved it by manually setting the metrics for all three types.
You can see my working solution with screenshots of the settings here: https://stackoverflow.com/a/20609766/955413
I used the Icomoon App to create the Emoji icon font as well as for creating custom icon fonts on a per project basis.
The Icomoon App allows you to do each of the following :
Get one or more icons from several popular icon fonts
Upload other fonts, which may be icon fonts but also regular fonts
Upload SVG files to use as icons
Combine any number of icons from any number of available fonts
Set the UNICODE hex value for whichever characters you need
Export and/or save the font set you create
For more details, see Create webfont with Unicode Supplementary Multilingual Plane symbols.
Is there any program that can convert a file into an animated gif by taking the bytes (whatever I see on an editor is seen) and producing them on frames? Im trying to change a large script I wrote into an image so that if I run it, it looks like as if the code is scrolling. I would use photoshop, if I knew how to use it. Even then, the code is really big, so I dont want to be doing it frame by frame.
Whatever you see on the editor screen is ... a screenfull, so why not a screen capture program like http://www.faststone.org/FSCaptureDetail.htm
However, I suspect that you want to convert the entire file to a gif, since you talk of scrolling. Is that so?
If so, be aware that animated GIFs are limited to 8 frames, so you might want to convert to another movie format.
You could, for instance, Google for "text to MPEG". If nothing does it directly, get something that adds subtitles & make your video a solid white background *or match your webpage).
Maybe simpler is something like this ...
A Scrolling Text Applet - Now Free. - Provide an animated look and feel to your web pages. Scrolling Text is a Java applet that will automatically size itself to the available area given to it by the HTML form via the WIDTH and HEIGHT properties of the APPLET tag. There are many configurable features of this applet including title, colors, font size and style, border width and color, graphics, background images etc.
Configurable parameters including;
Background Color - Define your desired background color
Title - If you want a stationary title then include this parameter
Font Size and Style - All text can have it's own Font size and style
Text Color - Specify the color of the text with this one
Border Width and Color - If you require a border then define it with these 2 parameters
Scroll Speed - Customise the Scroll Speed
Display Time - Vary the Display time of each page
This applet is easy to implement and configure and along with the example and help files you should have no trouble implementing your own customised Scrolling Text in your web pages. No understanding of java programming is required, everything is adjusted by parameters in the HTML tags.
Now FREE.
+1 for an interesting question.
(This is a post that I'm moving from ui stackexchange.)
We have some irregular shaped areas...imagine a map of the states of the US. Imagine also that inside each state there is a rectangular region that contains graphics and text. We want to make each of the states react to mouseover/mouseout/click.
If it is a straight up HTML/Javascript page (no Flash), are there other ways to implement this than image maps?
If this is not possible, I would also consider just having the rectangular region within each state react to mouse events.
Does "straight up HTML" mean you can use Javascript? If so, consider the Raphael javascript library, which wraps SVG. Check out their homepage for a great overview of what you can do, including this example of counties (?) of Australia: http://raphaeljs.com/australia.html
You could also consider processing.js, which is a similar visualisation library but wraps canvas as opposed to SVG.
how about coordinates? grab your map of the us, figure out the polygons that contain a state, and every time the user clicks somewhere, get the position of the click and figure out what polygon that position is in.
the only tricky part is doing the translation from logical to physical. i.e. when you get the location of a click it'll probably give you the location in global browser positioning, and you'll need to figure out where your image is using jquery's .position().