So, I have to build an IDE inside Unity 3D. So far I made a canvas, panel, input field, image and a text on the image. So... my question is how to dynamically show the line numbers on the left side?
Make sure your input field's line type is set as 'Multiline New Line'. Get the text from OnValueChanged event of your input field. Split the string by '\n'. You will get the array of lines. The length of that array is number of lines in your input field. Add 1 to that length value & use it as your last line number.
Related
I'm working on a mind map editor in which the user can draw boxes and write text in them. However, the TMPro input fields I'm using in those boxes have extra-wide caret when I type in them, and changing the fonts didn't solve the problem. Here are some images of the issue:
The caret is so wide that it can push the text inside out of the box:
I tried to lower the caret width in my script, but it's an int and has already been set to 1. Can you give me some possible reasons as to why this is happening?
I solved that problem by multiplying width+height of my inputfield by 100 and dividing its scale by 100.
Don't forget to increase the font size significantly.
Alright, I do not know how to fix this and only ran into this problem after trying to put in some longer text on a UI Text component. I have tried both pasting a value into its Text attribute through the Unity editor, and setting its value programmatically like this:
t.GetComponent<Text> ().text = "This is where meat, fish, and [...] (long text)"
Because Horizontal wrap is on, the text wraps when it reaches the edge of the available space.
However, the text displays backwards. Meaning, the start of the paragraph is at the bottom, and bottom at the top. Taking off wrap fixes this, but then the font size has to be really small (or it won't all be visible), and it can't form a normal paragraph because it has to... you know... wrap.
Is this a bug in Unity?
This is what happens - as you can see, it is displayed backwards:
The negative Line Spacing value is what is causing the issue here:
When the value of this field is less than 0, the lines will actually be arranged backwards, leading to the behaviour you're currently encountering. Just change the value to a positive number to have the text display correctly.
The way I understand how emacs displays stuff is that essentially everything is text. If you have something in the fringe or linum mode active, essentially your document is pushed a little inwards and something is written in the first few columns.
I'm writing a function for putting some stuff into the head-line and this works nicely, however, I would like the start of the text to be aligned with the start of the document.
Thus I am looking for a way to get the number of columns that sit between the frame border and the start of the actual document.
Let me illustrate using a poorly produced graphic:
I want to get the number of columns (or the number of pixels) that make up the distance marker by the ruler just below the line number 10000.
The function which returns this value shall be executed in the functions which create the head-line.
There is a function called window-inside-edges that you can use to determine the offset of the text area ("window body") from the total width and height of the window in columns and lines, respectively.
It returns a list four values; the order is left - top - right - bottom, so to get the value you are interested in for the current window, just do
(car (window-inside-edges))
More information on window coordinates can be found here; this page has information about window sizes, including a nice ASCII representation of window elements.
I'm trying to set the text field of a shape to the name of the layer it is on (Visio 2010). I should be able to set the formula to this:
=ThePage!Layers.Name[LayerMember]
but that doesn't work because LayerMember is a string and a shape can be on multiple layers, i.e., LayerMember = "3" if it is only on the 3rd layer but can be "3;2;5" if it is on three different layers. So, using LEFT(LayerMember, 1) gets the first value in the list but putting that in the index field of the above formula doesn't work either. Putting a static value in the index field works just fine but I want to be able to change the layer of a shape and have the text on the shape change to the layer name.
Using LEFT(LayerMember,1) returns a string. I can't find a way to convert the string value to a number to get the layer name value from the page's shapesheet.
I'm new at Visio but for some reason I can't figure this one out.
Layer is a property of shape, so try shpObj.Layer(1).Name this will give you the name of the first layer the shape is on. You will need to check shjObj.LayerCount to make sure that the shape actually is on a layer.
I am using CGPDFScanner to scan the pdf. Should I use Td operator to find positions of text? Can I have an example that how to use this operator to get positions of the text? Current I have used Tj and TJ operator to find the text. Now I would like to know position of each word in a single page of pdf. How can I do that?
Thanks
Look this library:
https://github.com/KurtCode/PDFKitten/
search and highlight text
To get the coordinates of the text you need to keep track of the text transformation matrix. See section 5.3.1, "Text Positioning Operators" of the PDF 1.4 Reference. (I'm not sure if later versions of the reference number things the same or not.) While the Td operator will set the current translation in the text matrix, there are other operators that affect the text matrix and other text state, as well. You need to keep track of the text matrix as the file is processed. The Tm operator will directly set the text matrix. The TD operator moves to the next line and offsets by the x and y parameters. T* just moves to the next line.