increasing and decreasing font size in custom font j2me - java-me

My j2me application uses a custom font in res folder
res
font-18
font-24
font-27
which are fonts with separate sizes for matching screen resolutions.
and i use
if(resolution<=small)
{
font-res ="font-18.res";
}
else if(resolution<=large)
{
font-res ="font-27.res";
}
and so on..But now that my jar size exceeds 2mb i have to think of decreasing the items in res and found removing any 2 makes a big difference in jar size. (It becomes <2mb) .Is there any other means of doing this? Please help me to find a solution

I don't know how you are creating your custom fonts or how they are stored or how many different sizes you're talking about, but I can tell you that I am currently developing an app where I have included 13 different sizes of a custom font, and those 13 files only use 175kb of space in total.
Those 13 font sizes are currently stored as unoptimized 24bit PNG files. When/if I optimize them, using a tool like pngout or optipng, then they'll take up even less space.
There are a number of things you can do to reduce jar size in general, such as obfuscating the code (a functionality that's usually built into your IDE nowadays, and is just a matter of you turning it on in your project properties).
Some people claim that earlier versions of JDK creates a 5-20% smaller JAR size than later JDK versions. I haven't tried this myself.
But you can find lots of additional info if you google for it.

Related

How to correctly layout wxWidgets/wxGTK items taking their size into account?

Everything inside my application is laid out using sizers with hard-coded border sizes. This makes it fit very nicely inside Windows with wxWidgets:
But when I started porting it to Linux with wxGTK, since GTK+3 elements can vary a lot in size, everything ends up being misaligned:
Is there a way to responsively layout items taking into account that controls can be in different sizes, and the discrepancies between points and pixels as units of measurement?
You can't hard code any sizes to have a fighting chance of a layout working well on different platforms with different font sizes, DPI settings etc. If you're defining your layout in C++, use wxSizerFlags::Border(), DoubleBorder() etc methods. Also, align controls relatively to each other, e.g. using Center() for all the controls that should be in the same row (or use wxFlexGridSizer).

How to increase font size in xdiskusage?

I have a 4k monitor so (not surprisingly) the text diskusage in xdiskusage is far too small. Unfortunately, there is no single way to reset dpi in linux, and it is sometimes necessary to make application specific adjustments.
Does anyone know how to change the dpi and/or font size for xdiskusage?
FYI I've already implemented some 'generic' fixes:
My ~.xprofile contains 'xrandr --dpi 157'
My autostart file (I'm using openbox) contains 'xrdb -merge /home/moi/.Xresources'
These two things fix display problems for most apps.
Some QT apps need
'export QT_DEVICE_PIXEL_RATIO=2' but that doesn't work for xdisusage.
I'd appreciate any thoughts on this.
thanks
xdiskusage uses FLTK. In general there is not a way to increase the font size in FLTK applications, according to Change GUI font size, though both that thread and High DPI with FLTK mention setting FL_NORMAL_SIZE to a larger value. FL_NORMAL_SIZE is set to 12 in xdiskusage.C, though simply changing that and recompiling may not give the best results, as mentioned also in the “Change GUI font size” thread. Also, there are several places in xdiskusage.C that set font sizes at runtime, as well as one in panels.C, that may need to be changed.

Default font size of JavaFX under Linux is larger as on Windows

I noticed that the default font is way larger in JavaFX under Linux (Ubuntu XY) as it is under Windows. Since screen space is sometimes quite limited i would like to have it ideally the same size as it is under Windows. Is there a simple way to enforce the same default size / the same DPI value?
In short, font rendering will depend of the OS. So you will have more/less pixels for the same word depending of the OS where java is running. One good practice is to use: USE_COMPUTED_SIZE as much as possible to avoid problems and let your app just fit by it self depending on the size of the fonts.
Check this guide to know how java works with fonts:
http://docs.oracle.com/javase/7/docs/technotes/guides/intl/fontconfig.html
This is not 100% related to your question but just check these comparisons (Windows,Linux,Mac):
http://fxexperience.com/2013/01/modena-new-theme-for-javafx-8/

android:pitfalls of deleting ldpi/mdpi folders

I was wondering what are the pitfalls of deleting the ldpi/mdpi/hdpi folders on my android project? Can i just copy all the images in the drawable folder instead?
I did see the following links about UI development for android
http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
http://developer.android.com/guide/practices/screens_support.html
thanks
PS: I 'm referring to all the images that are being used, background,icons,menus etc...
If you want to, go for it. Although not the best practice, if your application is quite conservative in terms of graphics then this may be a reasonable approach.
PROS:
Smaller .apk size
Easier to manage images (add/edit/remove)
CONS:
Images may be too high res or too low res for different screen resolutions.
If too high, images are scaled down on the fly which eats up processing power (+ unnecessary memory consumption).
If too low, images will lack detail and may look bad.
Lower-end devices have a lower memory cap (lowest being 16MB I think) - what may seem to work on your test device may not work on another (OutOfMemoryError!).
Update
If you want a quick way to make icons for all resolutions check out: Android Asset Studio

How to put textures in one file (power of 2)

I want to create big texture which is power of 2 and put in this file a lot of smaller textures.
You know, I have several textures which are not power of 2 so I cant load them to my program. I have to put them in one file (512x512 for example).
Do you know any program which can do it for me automaticly?
Is there any limit of size of texture? Can I use for example 8192x8192 file? Or I have to use few smaller.
The keyword you're looking for is texture atlas.
The maximum texture size is GPU-dependent, 8k is fine on newer cards. Such a texture consumes, however, a vast amount of VRAM (and it gets worse if you count in MIPs). So it might be better to use several smaller textures and have only those in (hot) VRAM which you really need.
There are several applications that can help you pack images into a texture atlas. Zwoptex has both a free Flash version and a commercial Mac app. TexturePacker has a Mac and Windows app, and a command line version, some features are free and some require a paid license. These output the packed images into a single image and an associated data file with coordinates on the location of the packed images. They also can trim the transparent regions from around any given image, if any, saving even more space.
There are some more tools, some open source, listed in answers to this question.
The advantages of packing into one texture are potential space saving, but also fewer OpenGL state changes when drawing several images from the texture, for better performance.

Resources