pgundlach on master
Move main.html to publisher.htm… Update example aesopgnatbull Update example grid and 15 more (compare)
I am currently working on a project where I need to place multiple logos of corporations. While they all do have different heights/widths/dimensions they need to be centered in a certain space. Is there a way of placing images so they are expanding to the maximum set width/height (whatever is smaller) while keeping the aspect ratio – and centering it (horizontal/vertical). From a web developer point of view I am basically looking for something like "object-fit: contain".
For now I only see the possibility to
<Image file="filename.pdf" maxwidth="4" maxheight="2" />
which shrinks the image and keeps the aspect ratio (if the natural image size is bigger than the max-values – but it shifts the image either to the left or top.
Is there a way of working around that which I currently have missed?
@pgundlach unfortunately not as some logos are higher than wide and with others it is the other way round – so in the end I would need to have a container to which the image could expand (but not exceed those limitations). However, I agree that it probably makes sense to open up an issue and explain it more detailed. I will do that tomorrow morning and create a small visualization of my use case which should help clarify my problem.#
Thanks for your quick response by the way.
@pgundlach just wanted to quickly follow up my question from yesterday evening. The missing piece that I had not considered using – but eventually solved my problem – was the
Table element. Setting
width as well as a
stretch="max" on a Table element and
minheight="2" align="center" on the child
Tr creates a container in which I am able to place my logos in a way that they are always centered on the x as well as the y axis.
That in combination with
maxhight on a child image is pretty much what I was looking for.
I am really looking for working closer with the publisher – it is an amazing pice of software. Thanks a lot for that
fontfaceis also good, (this is
fontfamilyin version 4.1.11 and above)
Just stumbled upon an issue with my most recent speedata work that results in characters overlapping each other.
The issue only occurs if I don‘t use the pre-build in fonts but rather copy a custom one to the working folder (tried with multiple ones including the popular Inter font as well as the Apple default SF Text).
The layout.xml configuration below is a very barebone excerpt that leads to the issue:
<Layout xmlns="urn:speedata.de:2009/publisher/en" xmlns:sd="urn:speedata:2009/publisher/functions/en"> <Trace grid="yes"/> <LoadFontfile name="InterRegular" filename="InterRegular.otf" /> <DefineFontfamily name="inter" fontsize="12" leading="70"> <Regular fontface="InterRegular"/> </DefineFontfamily> <Record element="data"> <PlaceObject> <Textblock> <Paragraph> <Fontface fontfamily="inter"> <Value>This is a test</Value> </Fontface> </Paragraph> </Textblock> </PlaceObject> </Record> </Layout>
Am I missing something out?
As always thanks for your help :)