How can I disable anti-aliasing for particular sprites in HaxeFlixel?
To be specific, I need to disable anti-aliasing for some FlxTexts, because I'm using a font that is very pixellated on purpose and looks much better that way.
I've tried .textField.antiAliasType, but that doesn't seem to have a 'disable' possibility. Nothing else looks related to anti-aliasing.
Flash doesn't have an option to "disable" antialiasing on text. You only have control over this property if the font is embedded (but you still can't disable it).
If NORMAL and ADVANCED don't work for you, the alternative is to make your font a bitmap font and use flixel's bitmap text and font classes to handle it. Flixel has helper functions for Pixelizer- and AngelCode-generated bitmap fonts here.
Related
I was browsing SVG fonts in MDN, where it is mentioned that <font-face>, <missing-glyph>, <hkern> and <vkern> are depreciated. Only <glyph> is not depreciated. It does not mention anything about a recommended way of specifying the font face properties.
The W3C SVG recommendation also does not say anything about an alternative way of specifying SVG fonts, apart from noting that everything in the <font-face> can be done equivalently in CSS. It does not provide any alternative for <hkern> or <vkern>. I intend to create a standalone SVG file, not to be modified by the site CSS, so I would like to keep the whole font definition in the SVG.
So, what is this obscure new way of specifying SVG fonts?
"SVG fonts" as a data file that uses SVG markup to define a font resource has been deprecated; it turned out to be a bad idea, and ended up not addressing the issues that typography on the web needed addressing. It was added in SVG 1.1 but removed again in SVG 2.0, and almost all browsers that did end up adding support for it removed that support again since.
Instead, all browsers now support "webfonts": regular OpenType fonts packed for the web using the "Web Open Font Format", aka WOFF/WOFF2, based on the OpenType format, which supports several different outline types:
TrueType (quadratic curves and compound glyphs, often with ttf extension, but the extension is literally irrelevant)
Type2 in CFF/CFF2 (cubic curves and arbitrary subroutines, often with otf extension, but again: the extension is wholly irrelevant)
Embedded bitmaps (yes, OpenType fonts can indeed be true bitmap fonts, with as many different bitmaps as necessary to cover as many pixel sizes as necessary)
SVG (that might be surprising, but SVG is the exact same kind of vector graphics language as TT and CFF/CFF2 are, so it made sense to allow glyph outline data to be specified using SVG as well, particularly for fonts that need explicit colour palettes, like emoji fonts)
So if you absolutely need to keep your SVG data around, then make yourself an OpenType-with-SVG-outlines font, and then pack that for the web as a modern WOFF2 (or older WOFF) and you're good to go. There are plenty of online tools to do that for you, but you can also just use something like the open source FontForge application if you want a font that only includes what you need, instead of what online tools foist into them.
I have Gray SVG icons next to each Menu item (inherited from another project) and displaied as background.
I need to show them black or white but I don't how to achieve this.
As backgrounds I can't use fill css property. I tried with filter:brightness(100) to make them white but I loose anti-aliasing (and analogue with filter:brightness(0) to make them black).
Mask has still serious compatibility issues (e.g. Firefox does not allow external svg).
I tried also to import them as data-uri with LESS feature, but it was unuseful, so.... any suggestion?
I have a set of blue icons in sprite png, is there an easy way to change the color of each icon using a tool like Paint.net
What I've tried so far is changing pixels color one by one, but it's really troublesome
I've juste found an answer : https://stackoverflow.com/a/6059779/288387
Use Photoshop, Paint.NET or similar software and adjust Hue.
You can use Photoshop to swap certain colors with colors of your choice. This way, you have more control, as you can replace each shade separately.
I'm trying to draw text over a bitmap image and I've done some research and found that .NET/GDI+ doesn't support OTF fonts. I read somewhere that you could use TextRenderer.DrawText to render OTF fonts with GDI, but I can't seem to figure out how, nor does the quality compare to Graphics.DrawString in the least bit.
First of all, is it possible to use OTF fonts at all in VS or did I read something incorrectly?
Second, If the answer is TextRenderer.DrawText, how do I use the OTF fonts? It looks like I have to use the System.Drawing.Font class, but I don't think those support the fonts and that's the issue, correct?
How do I get the fonts to render clearly like the TTF fonts using GDI+ (Graphics.DrawString)
Using Graphics.DrawString I was able to use a RectangleF (with specified width, 0 height) as a boundary for my text, and the text wrapped correctly. With TextRenderer.DrawText, the ability to use RectangleF disappears and only allows Rectangle which doesn't seem to allow 0 height, while still allowing text to display (ie. text must be within the rectangle, and text wrapping does not work). Am I doing it wrong?
Any help would be greatly appreciated. If this cannot be done, is there a way to convert the OTF fonts, or find the Gotham font family online in TTF version? I really need these fonts!
I am building a website with a TON of png-24 files that have transparent background. In IE 6 they obviously aren't displayed correctly, so I need some sort of reliable, good solution that will fix the PNG problem in IE and require little work and be reliable. Any good ideas?
For IE6 transparency I follow a personal flow:
1. If there is just one or two PNG images (like a logo, or a normal image) I just use filter:
#selector {background:none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='test.png', sizingMethod='crop');}
Problems: If applied to a link, it will no longer be clickable. Possibly apply to the h1#logo and have the a be transparent.
2. If I have a lot of 24-bit PNG files, or special use cases (repeating background, etc), I use DD_belatedPNG
IMPORTANT FOR IE7 + IE8: You cannot animate or combine the filter:alpha (which is used for overall opacity on an element in IE and also used by jQuery to set opacity) property with 24-bit transparent PNG images. It changes it to look like 8-bit transparency, with everything that is not 100% opaque or transparent taking on a black background.
Here are a few good png fixes for ie6:
http://labs.unitinteractive.com/unitpngfix.php
http://www.twinhelix.com/css/iepngfix/
There are a lot IE PNG fixes on the net, which basically all work with the same technique. The older Internet Explorers do not support alpha in PNGs directly, but they all have a filter that does so. So writing the following code as part of a css of an object puts the image in the src to the background of the element:
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.png');
That way, you can easily display transparency in the Internet Explorer. However it's a lot easier to just get one of the png fix scripts (in JavaScript) and include it to your page inside of conditional comments. Then the script will make all your images working automatically.
We used Dean Edwards' IE7 for this. (So named before IE7 came out.) It's been good for that kind of thing.
There are currently many options to get this working. The standard is apply a DirectX filter through CSS to change make the PNG transparent in IE6. There are even scripts that will automatically do this when the webpage loads from an IE6 or less client.
http://www.google.com/search?btnG=1&pws=0&q=transparent+png+ie6