How does the ZPL ^RS command works? - rfid

According to the manual in the ^RS command the second parameter sets the read/write position of the tag.
But in the description it says
For the ZD500R only: F0 to Fxxx (where xxx is the label length in
millimeters or 999, whichever is less)
But it also says
The printer prints the first part of a label until it reaches the
specified distance and then begins programming. After programming, the
printer prints the remainder of the label.
So I'm confused, the value in mm has to be the length of my entire label or the distance between the beginning to RFID tag?

Related

Why is there a difference between "width" and "actualBoundingBoxLeft + actualBoundingBoxRight" in a "TextMetrics" object of a HTML5 canvas?

When I call measureText as shown in the snippet, I get the following result:
{
"width": 45.43333435058594,
"actualBoundingBoxLeft": 0,
"actualBoundingBoxRight": 45.35,
"actualBoundingBoxAscent": 18,
"actualBoundingBoxDescent": 0
}
Why is there a difference between width and actualBoundingBoxRight, if actualBoundingBoxLeft is zero?
c2d = document.getElementById('canvas').getContext('2d');
c2d.direction = 'ltr';
c2d.font = '24px serif';
console.log (c2d.measureText('TeX'));
<canvas id="canvas"></canvas>
Hope I get what you are asking, I'll give it a go.
The width property gives the text's advance width. Space taken excluding left and right-side bearing.
– width attribute
The width of that inline box, in CSS pixels. (The text's advance width.)
– actualBoundingBoxLeft attribute
The distance parallel to the baseline from the alignment point given by the textAlign attribute to the left side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going left from the given alignment point.
Where it also gives the note:
The sum of this value and the next (actualBoundingBoxRight) can be wider than the width of the inline box (width), in particular with slanted fonts where characters overhang their advance width.
– actualBoundingBoxRight attribute
The distance parallel to the baseline from the alignment point given by the textAlign attribute to the right side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going right from the given alignment point.
Some examples
Take this times f with data from canvas's measuereText (normal left, italic right):
ERR: Switched places for middle and bottom width line (blue ones), but did not update the labels. "middle" is "bottom" and "bottom" is "middle" as for the labels in the picture. I'll try to get time to upload a new later.
Especially the slanted version shows this well. The blue line following the textBaseline (gray horizontal line), and starting at textAlign (gray vertical line) show the width value for the glyph. That is how much the font advances the "typehead".
Bounding box left / right are the extremes in horizontal expansion. If one look on it as an rectangle. Same goes for Ascend and Descend. They are the extremes up / down. But, as font's "overlap" (kerning etc.) it is not a factor for width which represents advanced width.
The sum of the box width is 111 + 39 = 150 but the width is only 72.28.
As for your sample, it is harder to catch with such small fonts. (Relatively speaking). Increasing the for to 1024px or what ever gives a clearer result. There is so small fractions and path calculations that one will miss subtle pixel fractions. With 1024px:
actualBoundingBoxAscent : 747
​actualBoundingBoxDescent : 14
​actualBoundingBoxLeft : -10
​actualBoundingBoxRight : 1933.5
​width : 1938.5
The difference (1933.5 + -10 = 1923.5) is still small, considering the total width, but at least present in the served object.
Another sample with +:
As one observe the glyph advances the text a lot more then what it occupies in painted pixels. One can even have cases where a glyph does not advance the text at all. They can still stand alone in a text, but it's definition applies to the previous glyph in a way ... For example dấu hỏi or hook above has zero width.
But some are still defined as advancing characters for example:
Also interesting with that sample is to see how Descent is negative, (not going down below textBaseline), and Ascent is also present. Logically when one look at it, but can be a gotcha.
Could scale up the test on the canvas, but would have to look at it closer. Way too long since I worked on cavases. This is a close view, but have not validated or checked how precise (down to pixel) the lines are.
If it is correct, it show a subtle diff where the width advances at the end of TeX using 24px font.

Fastest way to get X/Y position of text or text-based shape in screenshot?

I'm trying to create a script for Linux that will detect where the text cursor is. This should be done in maximum 1 second. In order to implement this, the best solution seems to be to programmatically add some text via xdotool, take a screenshot via some other utility, try to figure out the position of that text, and then remove the text we've inserted using xdotool again.
I tried inserting a random string (like <-- CURSOR HERE). Using Tesseract 4 it takes about 20 seconds to find the position of the string, although it's very precise in terms of pixel coordinates. I was not able to use whitelisting (in version 4 of Tesseract) to narrow result to specific letters or digits only, which I assume would speed up processing.
I don't know what font the user will be using, but every font has dashes and slashes, so I could create some sort of shape (for instance, |/\|/\|/\|/\|), and use some library to detect that shape. What would be a good choice?
I don't care about what's on the rest of the screen: it could be more text, images, etc. I only need o know where my random string is (<-- CURSOR HERE, |/\|/\|/\|/\|, or can you think of anything else), and get its X/Y position in pixels.

How to change the default label positions of connectors in Enterprise Architect

I'm drawing activity diagram by Enterprise Architect 12. The diagram type is Activity under UML Behavioral. I found the positions of the labels of connectors are close to the target element as shown in the picture. It's very confusing.
How to change the default label positions to make them close to the source element as shown in picture?
Or is there any easy way to change the label of connector from Target Top Label to Source Top Label?
Better you use Guards for the label which you find in the Constraints tab. These appear in the middle label position and enclosed in square brackets. This is actually what you want to show.
For your amusement here's my original answer
There is no way to change the label position the way you want it out-of-the-box. You will need to write a script to do that.
There are two ways to accomplish such a script. The most comfortable is to use an add-in that responds to EA_OnPostNewConnector. You would then need to check whether the connector is one from a Decision to an Action and move the label accordingly.
The second one is to have a simple script (you might edit in EA's scripting window) that you run for an open diagram to scan for all Decisions in a diagram and alter the label position accordingly.
Altering the label
Once you got a connector from a Decision to an Action at hand you will need to change the label position like this:
get the according connector from DiagramLinks since it has the label position
get the element IDs from Connector.ClientID and .SupplierID and retrieve the elements with Respository.GetElementByID(<id>)
assign both elements to either decision or action by looking into the Element.Type
get the according DiagramObjects from the diagram which match the both elements (so you can get their position on the diagram)
now it's time for a little trigonometry: the position (DiagramElement.Left, .Right, .Top and .Bottom contain the appropriate coordinates) of the two elements makes out a vector at which end you calculate (I will leave you some fun) the label position where you think it should go
finally you take this coordinate and put it into the label position (see below).
The label position is stored in DiagramObject.Geometry. This is a semicolon separated string where one tag is LRT=<colon-list>;. <colon-list> itself is a colon-separated list where two are something like OX=-1:OY=-71: and represent the label position. This is a position relative to the "normal" position where the label is placed initially by EA.
So all in all: lot's of fun awaiting you :-/

What do ^[[m, ^[[0m escape codes represent?

Code ^[[00;00m means reset color to default, however, in some programs (like source highlighter highlight for example) code ^[[m is used as if it would also serve the same purpose. What does ANSI state about such code, and also about similar ^[[0m?
"ANSI" in this context was obsoleted long ago by ECMA-48. So the appropriate place to start is that document.
Section 8.3.117 SGR - SELECT GRAPHIC RENDITION says
Notation: (Ps...)
Representation: CSI Ps... 06/13
Parameter default value: Ps = 0
SGR
is used to establish one or more graphic rendition aspects for subsequent text. The established aspects remain in effect until the next occurrence of SGR in the data stream, depending on the setting of the
GRAPHIC RENDITION COMBINATION MODE (GRCM). Each graphic rendition aspect is specified by a parameter value:
0
default rendition (implementation-defined), cancels the effect of any preceding occurrence of SGR in the data stream regardless of the setting of the GRAPHIC RENDITION COMBINATION MODE (GRCM)
That is, 0 is the default parameter if none is given (so ^[[m and ^[[0m mean the same thing. Repeating the parameter also makes no difference (cancelling something that was already cancelled does not uncancel it), so ^[[00;00m still means the same thing.

LaTeX \includegraphics and textline

Ok, I am beat. I tried a few things but I am unable to make this happen. I need some help now.
I want to be able to have some text and picture side by side (only one line, thus no need for wrapping or other fun. The picture is small enough to fit in a text line):
This is a text <temp.jpg placed center to the textline>
Problem is, when I use
This is a text \includegraphics{temp.jpg}
the pictures baseline is alligned with the text baseline. I want the picture (vertical) center to be aligned with the text baseline. How can I make this possible?
This is a text $\vcenter{\hbox{\includegraphics{temp.jpg}}}$
It sounds like you want \raisebox (see the raisebox section of the LaTeX wikibook), with a negative argument. Use dimensions ex (the notional height of an 'x' in the current font) or \baselineskip (the size between text baselines) as your units.
If you want to do more complicated things, such as move the graphics box down by half its height, you can, but it gets fiddly. If the graphic size isn't unpredictable, you're probably better off tuning this by hand anyway.
In my opinion, most simple answer \raisebox{-0.5\totalheight}{<your graphic here>}
This is a text \raisebox{-0.5\totalheight}{\includegraphics{temp.jpg}}
Explanation:
\raisebox moves vertically the whole text/picture given as second argument. The first argument is the vertical shift as a length. This command provides the length \totalheight which is, self-explanatory, the height of the whole text/picture that you want to raise. The factor -0.5 lowers exactly at the half of the length(as the question demands). For aesthetic adjustments just modify the factor's value.
By the way, with this method there is no need to get into math mode as in #AlexeiMalistov answer, and no need of double command \vcenter + \hbox

Resources