usability – Is it good practice to place tabs at the same level when search is the main feature? How to deal with spacing?

There are two potential approaches, but you have to have a consistent design approach/philosophy if you want to achieve the best user experience.

The search feature, if applied globally to the application, should sit at a level above the tabs so that the user isn’t confused about whether the search results relate to the contents in the tabs or not.

However, if the search feature only retrieves results relating to what is in the tabs, then it can also make sense for it to sit in the same level, provided that you can manage the spacing. This can be done by common strategies used in browsers to manage tabs (when you have too many to fit on the screen, especially in devices with narrow widths) or create a more compact search call-to-action (e.g. icon that expands when clicked and collapses when not in use).

javascript – jQuery: search name without spacing

I’m a newbie to jQuery/JavaScript. During my learning process, I found a search filter code from W3schools by using jQuery. I have tried to used it in my code and it worked well. Now, I wonder how could I get the search result without spacing when I enter the names? For example, one of my data is
‘Jacky Chan’, and I wish that I can get the search result by just entering ‘jackychan”https://stackoverflow.com/”Jackyc”https://stackoverflow.com/”JackyChan”https://stackoverflow.com/”jackyc’. Thanks in advance.

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myList li").filter(function() {
  $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
   });
 });
});
</script>
</head>
<body>

<input id="myInput" type="text" placeholder="Search..">
<br>

<ul id="myList">
  <li>Jacky Chan</li>
  <li>Lim Hai Yang</li>
  <li>Soul Wong</li>
</ul>

</body>
</html>

opengl – Applying spacing between moving, rotated rectangles

I am trying to implement basic Snake game with movement based on timestep. For now I’ve got something along those lines:

Update function:

glm::vec2 headPosition = glm::vec2(m_segments.begin()->m_sprite.get_position());
float angle = m_segments.begin()->m_sprite.get_angle();

m_segments.begin()->move();
    
for (auto it = m_segments.begin() + 1; it != m_segments.end(); it++)
{
    glm::vec2 oldPosition = it->m_sprite.get_position();
    float oldAngle = it->m_sprite.get_angle();

    it->m_sprite.set_position(headPosition);
    it->m_sprite.set_angle(angle);

    headPosition = oldPosition;
    angle = oldAngle;
}

Move function:

glm::vec2 position(m_sprite.get_position());
position.x +=  cosf(glm::radians(90.0f - m_sprite.get_angle())) * VELOCITY_SCALAR;
position.y += -sinf(glm::radians(90.0f - m_sprite.get_angle())) * VELOCITY_SCALAR;

m_sprite.set_position(position);

Basically I set next segment position to the old position of previous segment. As expected spacing between those segments is equal to timestep value. How can I calculate position so I can manipulate spacing between those segments?

c++ – DirectWrite and Set Character Spacing – Trouble using extended DW functionality

I’m having a hard time grasping the problem getting the newer/extended functions in dwrite_1.h to work with my existing code and hope that someone here can shed some light.

This is my existing set up…

 // HEADER
IDWriteFactory* pDWriteFactory_ = nullptr;
IDWriteTextFormat* pTextFormat_ = nullptr;
IDWriteTextLayout* pTextLayout_ = nullptr;
IDWriteTextRenderer* pTextRenderer_ = nullptr;

//CPP File in my PrepareText() Fcuntion.
hr = pDWriteFactory_->CreateTextLayout(
    str.c_str(),
    str.size(),
    pTextFormat_,
    gfx.GetWindowWidth(),
    gfx.GetWindowHeight(),
    &pTextLayout_);

I would like to be able to use the IDWriteTextLayout1::SetCharacterSpacing function outlined here :
MSDN Link

However if I change my IDWriteTextLayout* to be IDWriteTextLayout1* I get an error as pDWriteFactory_ cannot be initialised with an IDWriteTextLayout1 as an argument. This error occurs if I change IDWriteFactory* to an IDWriteFactory1* also.

What am I missing? Many thanks!

text – Line spacing when creating new line

I have a plot which has a legend where text occasionally needs two lines. While I’m able to adjust the space between labels using “Spacings” how can I change the line-spacing within a label to match. For example:

ListLinePlot[{RandomReal[10, 10], RandomReal[10, 10], RandomReal[10, 10]}, 
PlotLegends -> Placed[PointLegend[
Automatic, {"One Line Label", "Two-LinenLabel", 
 "Third One Line Label"}, LegendFunction -> "Panel", 
Spacings -> 0.1], {Left, Top}]]

Line Spacing

The second label has a larger gap than the others, which I can’t figure out how to reduce.

Question about spacing in .ttf fonts for android

I’ve been having trouble setting up a font to work well on my phone. I’m using an app that allows me to load ttf files into my system, the problem is spacing between lines/titles being too large (see attached screenshots).

I’m trying to figure out how to edit the ttf on font forge to resolve this, but it’s been to no avail.

new ttf font

Default font

layout – Spacing between UI components

There is a minimum amount of distance that should be adhered to if your creating tap targets. This is the lifted text from Googles recommendation on appropriately sizing tap targets. These guidelines apply if your making tap targets (two components, like links, that the user can tap on). If they are just normal components (and not links or buttons), there is no minimum “gutter” space that should be adhered to. It should be whatever space looks aesthetically the best.

Small or tightly packed links or buttons are more difficult for users
to accurately press on a touchscreen than with a traditional mouse
cursor. To prevent users from being frustrated by accidentally hitting
the wrong ones, tap targets should be made sufficiently large and far
from other tap targets that a user can press them without their finger
pad overlapping any other tap targets. The average adult finger pad
size is about 10mm wide (a bit less than half an inch), and the
Android UI guidelines recommend a minimum tap target size of roughly
7mm, or 48 CSS pixels on a site with a properly-set mobile viewport.

You should ensure that the most important tap targets on your site—the
ones users will be using the most often—are large enough to be easy to
press, at least 48 CSS pixels tall/wide (assuming you have configured
your viewport properly). Less frequently-used links can be smaller,
but should still have spacing between them and other links, so that a
10mm finger pad would not accidentally press both links at once. Users
should not have to pinch zoom (or rely on other browser UI features
for disambiguating finger taps, such as Chrome’s popup magnifying
glass) in order to easily and reliably press the desired button or
link.

Make important tap targets large enough to be easy to press

This applies to the tap targets your users will use the most, such as
buttons for frequently-used actions, search bars and other important
form fields, and primary navigational links. These tap targets should
be at least 7mm (48 CSS pixels if you have configured your viewport
properly), and should have additional spacing around them if they are
any smaller than 7mm.

Ensure there is extra spacing between smaller tap targets

It is reasonable for infrequently-used links or buttons to be smaller
than the recommended size of 7mm, but there should still be no other
tap targets within 5mm (32 CSS pixels), both horizontally and
vertically, so that a user’s finger pressing on one tap target will
not inadvertently touch another tap target.

8 – Add hover function on spacing between two fields

I have two fields: a text box(Box 1) and a select list(Box 2). I am trying to show the select list when I hover the text box and also when I hover over the dropdown.

The spacing in between the fields is not letting me hover over the select list. Is there any way I can hover in the empty space after the text box?

I tried the following but they didn’t work:

  1. Added div element around the first box using fieldset module but that didn’t let me select anything
  2. Tried removing all margins and padding which also didn’t work

enter image description here

c# – labels have huge line spacing causing overlapping each other in wpf

Issue:

I have a wpf application with some labels in a Grid. The Grid Row height is not set

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="1*"></ColumnDefinition>
        <ColumnDefinition Width="1*"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>
    <Label Content="Created tickets last week:" Grid.Row="0" Grid.Column="0"></Label>
    <Label x:Name="TicketsCreatedLastWeek" Content="0" Grid.Row="0" Grid.Column="1"></Label>
    <Label Content="Target tickets per day:" Grid.Row="1" Grid.Column="0"></Label>
    <Label x:Name="TargetTicketsPerDay" Content="0" Grid.Row="1" Grid.Column="1"></Label>
    <Label Content="Tickets done Today:" Grid.Row="2" Grid.Column="0"></Label>
    <Label x:Name="TicketsDoneToday" Content="0" Grid.Row="2" Grid.Column="1"></Label>
    <Label Content="Day Ticket Progress:" Grid.Row="3" Grid.Column="0"></Label>
    <ProgressBar x:Name="TicketDayProgressbar" Grid.Row="3" Grid.Column="1"></ProgressBar>
</Grid>

within the WPF Application, it looks like this:
enter image description here

The overlapping itself is not the issue. By making the form bigger, everything shows up correctly.

My main concern is the huge margin around the text. There is no margin set. It appears to be 1 full line height.
enter image description here

Question:

Is there a way to reduce line spacing to 0, so that I can actually format and put margin as I please?

Different level of spacing between rows on different lines while converting a csv file to txt file using python

I have to convert a .csv file into .txt file which I did and I have the following code.

text_list = ()

with open(csv_file,"r") as infile:
    for line in infile:
        line = line.split(",", 2)
        text_list.append("t".join(line))

txt_file = 'test.txt'
with open(txt_file, 'w') as outfile:
    for line in text_list:
        outfile.write(" " + line)
    outfile.close

But the problem is,

CSV file:

phi,Z,T
0,0,0
10.000005,1.2,3000.00
20.000005,2.4,6000.00

Required txt file:

phi        Z    T
0          0    0
10.000005  1.2  3000.00
20.000005  2.4  6000.00

Text file I have with the above mentioned code:

phi    Z    T
0    0    0
10.000005    1.2    3000.00
20.000005    2.4    6000.00

Thank you