Decimal Size for fonts not working in Jasper Reports - styles

I wonder why decimal sized fonts do not work with Jasper.
It gives validation error while using decimal font directly from iReport.
Using it via Style doesn't work.
I tried using <style size='6.5'>This is my sample text</style>, but in vain.
Do we have any work around for this?
Thanks for your time.
Regards,
Koushik

Doesn't look like this is a problem of iReport only.
Actually Jasper uses Integer.parseInt() to parse the font size when compiling a template. So I guess using a decimal font size simple is not supported.

Related

Converting sequence of SVG images (which contain Emojis) to a MPEG video

I googled and even asked chatGPT but I'm unable to find a solution and hope to get some guidance here.
First I've to mention that I'm not a programmer but rather a beginner.
Following a short description of what I'm trying to achive and what I've done so far.
I gather data and create a circular visualization using Circos which produces SVG
and PNG images.
(unfortunately the PNG doesn't give me the option of searching for
text an make replaecments), nevertheless I can use them to sucessfuly produce a
MPEG movie using FFmpeg. Therefore I need to use the SVG output to apply the
desired changes.
So I tried to use CairoSVG to render the SVG file to a PNG image but it does not
render emojis by default because the are not part of the SVG specification and
CairoSVG only supports features defined in the SVG specification. The Emojis are
stored as Unicode characters and are not natively supported in SVG
Next I tried to use PIL (Python Imaging Library) as it provides support for Unicode
characters, including emojis, when converting images to and from various formats.
Unfortunately PIL does not have native support for converting SVG files to PNG and
it seems that PIL is primarily designed for creating and manipulating images in a
variety of formats, but does not have built-in support for reading or converting
SVG files.
So now my questions are:
Would FFmpeg give me the desired results, if I compile it using the --enable-
librsvg option so it can convert a sequence of SVG images to a video but i'm not
sure if it supports emojis rendered correctly and want to spare me the hassle as
I'm pretty sure to struggle compiling it on my Mac running Ventura?
Are the maybe other ways or posibilities to solve that problem?
Many thanks in advance for your help or any hint :-)
Have all a nice weekend and take care
Regards,
Deekee
NB: an example of the circular visualization can be found here animated graph and the static version annotated graph
Problem solved, I used the html2image Python module which converts the SVG (including embedded Emoji's) nicely to a PNG image an then use those images to create a MPG4 video using FFmpeg.

Text distorting during PNG rendering in Apache Batik

There are some very strange distortion in the images that are rendered via Apache Batik.This issue is not temporary as the distortion is happening every time the call is made, at the very same co-ordinates for the same svg. This happens in Linux environments and I am not able to reproduce this issue in mac OS environments.I am using Oswald custom font (from google fonts) and there is usage of transformation attributes like letter-spacing, rotate functionality.
Tried many of the suggestions like:
1) Verified if the Oswald font is registered to the Graphics environment.
2) Removed text transformation attributes like letter-spacing,rotate, but still the distortion is occuring. We have also replaced letter-spacing attributes with kerning.Tried with shape-rendering="geometricPrecision" also to no success.
3) Tried with other fonts and din't face the distortion with Arial custom font, but with Oswald, Roboto the distortion still exists.Our usecase needs Oswald Font, hence we cannot use Arial font.
4) Tried SVG fonts by embedding the svg fonts in the svg file - No success.
5) Tried trim functionality but no success.
6) Replaced the characters where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.
7) Increased And decreased the font size by 1px where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.
I found few threads where the reason was mentioned that Batik rendering varies per OS environment but was not able to find any solution. Was anyone able to solve this?
Upgrading JDK from 8 to 11 has solved the problem.

Width of characters in standard svg font

I'm generating some simple svg for data visualization and as part of that I need
to render several lines of text. I'm using the simple text/textspan. However when
determining when to break the line, I need to know the width of the string. Note that I am not using javascript, these are static svg diagrams. My manual mockups work fine on all three platforms(Mac/Windows 10/Linux) in several different browser. I've been searching, but all attempts to find anything about string widths involves dynamic SVG and javascript. Is there any data anywhere on the character widths of the default fonts? I'm using rather simple svg. I'm using the default transform and coordinate space as well. Or do I have to write a javascript test page to return the widths?
Thanks.
The standard font is determined by settings of the renderer. Browsers will use the same font they use for HTML content, set by the user and depending on fonts installed on their system. That means text size will differ for each end user.
There is no way around measuring the text after rendering.

why when converted dxf file to svg using inkscape the dimensions of the diagram disappears?

This is the image is done in AutoCAD 2018:
This is how the converted SVG image appears:
How do I fix it?
I have also checked various online DXF to SVG converters but experience the same issue.
It is likely that the conversion programs struggle to handle complex entities such as dimensions, therefore, you may obtain better results if you explode the dimensions (and the resulting arrowhead blocks) prior to converting the DXF to SVG.
I solved the issue by using AutoDWG DWG to SVG Converter and now the dimensions are appearing fine. well, the drawings after converting from DXF to SVG format the lines are lighter because of less stroke-width and they can be changed manually.
thanks for the comment #Lee mac.
well this is the link http://www.autodwg.com/dwg2svgx/

Font rendering in XNA is getting low quality

I am currently working in XNA 4.0 trying to render a font that I got. The font is rendered with this:
spriteBatch.DrawString(this.font, this.text, new Vector2(10, 10), this.color);
But some of my letters gets blurry and low quality (See image)
I have tried to change the SamplerState of the GraphicDevice but that does not seem to improve anything.
-Update-
After testing one of the ideas were XNA would compress the text and in that case loosing quality i tried out to create my own font texture instead of generating one using a .spritefont. And then sending that into the contentloader, the results I managed to get was just slightly larger text but with the same artifacts.
See Image
And I was now wondering if the problem still can have to do with compressing problems or if there could be another issue making the font get a lower quality in the program compared to using it ouside the program.
The way I am currently loading my font is using
font= ContentManager.Load<SpriteFont>(FontPath);
It's because XNA uses compression for spritefonts. The possible workarounds are:
Use Nuclex framework, which includes an alternative font importer;
Make your own font texture, following the instructions from Shawn Hargreaves's blog;
In your SpriteFont definition, double the size of generated font, then draw it at half its size.

Resources