473,787 Members | 2,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

swap fonts' size

Hello, I wish to modify the dimension of the font within a given table (that
is, not yet in the whole page); when I hit a button, the font's size
increases by 1 point; another button decreases it by 1 point (starting from
the default size), and a last button will reset it to the original size.

Pratically, whichever might be the default size (which I set from three css,
swapped accordingly to the screen's res), the text inside that table it
should be resized only by step of +1 or -1 point from the default size. Any
ideas?

Jul 23 '05 #1
14 1513
Cartel wrote:
Hello, I wish to modify the dimension of the font within a given table (that
is, not yet in the whole page); when I hit a button, the font's size
increases by 1 point; another button decreases it by 1 point (starting from
the default size), and a last button will reset it to the original size.

Pratically, whichever might be the default size (which I set from three css,
swapped accordingly to the screen's res), the text inside that table it
should be resized only by step of +1 or -1 point from the default size. Any
ideas?


Yeah, I have an idea or two. Let the user use the built-in mechanism for
adjusting font sizes. Thats what it is there for.

Second idea: What has my screen resolution got to do with anything?
Well, anything other than my resolution. I promise you that 600X800 on
my 19" monitor does *not* look/perform the same as 600X800 on a 15 inch
monitor. Nor does it matter when it comes to the size of my browser
window. If I have a 600x800 browser window on a 2560x960 dual monitor
desktop, what in the world makes you think I want some huge monster font
on the page?

Stop f**king with the fonts - end of problem.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
"Randy Webb" <Hi************ @aol.com> ha scritto nel messaggio
news:Mp******** ************@co mcast.com...
Yeah, I have an idea or two. Let the user use the built-in mechanism for
adjusting font sizes. Thats what it is there for.
I've asked for ideas, not yet for "opinions".
Second idea: What has my screen resolution got to do with anything? Well,
anything other than my resolution. I promise you that 600X800 on my 19"
monitor does *not* look/perform the same as 600X800 on a 15 inch monitor.
Nor does it matter when it comes to the size of my browser window. If I
have a 600x800 browser window on a 2560x960 dual monitor desktop, what in
the world makes you think I want some huge monster font on the page?
UH? Sorry..... Are you ok?
Stop f**king with the fonts - end of problem.


Feeling lonely? Or just kinda philosophical?

(repeat)

Some serious scripts?

Jul 23 '05 #3
"Cartel" <bm*****@hotmai l.com> writes:
Hello, I wish to modify the dimension of the font within a given table (that
is, not yet in the whole page); when I hit a button, the font's size
increases by 1 point; another button decreases it by 1 point (starting from
the default size), and a last button will reset it to the original size.
That's hard if you don't know the original size. If you want the button
to increase the font size by 10%, then it's much easier. E.g.:

----
<script type="text/javascript">
var size = 0;
var delta = 10;
function fontSize(n) {
if (n == 0) {
size = 0;
} else {
size += n;
}
document.getEle mentById("table Id").style.font Size =
(100 + size * delta) + "%";
}
</script>

<input type="button" value="A-" onclick="fontSi ze(-1);">
<input type="button" value="A!" onclick="fontSi ze(0);">
<input type="button" value="A+" onclick="fontSi ze(+1);">
<table id="tableId">
<tr><td>Test</td><tr>
</table>
---
Pratically, whichever might be the default size (which I set from three css,
swapped accordingly to the screen's res),
Bad idea. The screen resolution tells you nothing about the actual
size of either browser or screen. I have a laptop with an extra CRT
screen attached. The larger CRT screen has the lower resolution (and I
can only begin to guess what you would think the screen resolution is
:).

Just go with the user's configured default font size.
the text inside that table it should be resized only by step of +1
or -1 point from the default size. Any ideas?


If it is imperative that the steps are 1 point, then you have to find
the current size *in points*. That might not even be possible, if you
don't have it provided to your script by whoever choses the style
sheet. What you can find, in some browsers, is the computed value of
the font size, which is probably in pixels, and there is no way to go
from pixels to points.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #4
"Lasse Reichstein Nielsen" <lr*@hotpop.com > ha scritto nel messaggio
news:oe******** **@hotpop.com.. .
If it is imperative that the steps are 1 point,
sorry, **pixels** :(

then you have to find the current size *in points*. That might not even be possible, if you
don't have it provided to your script by whoever choses the style
sheet.


Indeed, in order to avoid these probs (I guess), I arranged the thing so
that the three css's are swapped by a javascript accordingly to the user's
resolution :) (800x600, 1024x768 and 1280x1024 and above).

It isn't the user who choses the css's manually.

I use three css 'cause nowaday many people have screens which run over
1680.....

My fault, I didn't mentioned this. So that's why I found feasible a script
which swaps the size by 1 px step.


Jul 23 '05 #5
ps.: doesn't work; maybe 'cause the pages where it is enbedded, are
dynamically generated?

Jul 23 '05 #6
ps.: doesn't work; maybe 'cause the pages where it is enbedded, are
dynamically generated?

Jul 23 '05 #7
> Indeed, in order to avoid these probs (I guess), I arranged the thing so
that the three css's are swapped by a javascript accordingly to the user's
resolution :) (800x600, 1024x768 and 1280x1024 and above).


Why???

A properly written site works on ALL monitors. If you have to specify
different CSS for different (and always incorrect) browser sizes you haven't
developed a good site.
Jul 23 '05 #8
"Cartel" <bm*****@hotmai l.com> writes:
"Lasse Reichstein Nielsen" <lr*@hotpop.com > ha scritto nel messaggio
news:oe******** **@hotpop.com.. .
If it is imperative that the steps are 1 point,
sorry, **pixels** :(


Ah, probably much easier :)
Indeed, in order to avoid these probs (I guess), I arranged the thing so
that the three css's are swapped by a javascript accordingly to the user's
resolution :) (800x600, 1024x768 and 1280x1024 and above).
I hope you are not going for exact matches for the first two. My
screens at work are currently 1152px and 1440px wide. Put together,
that gives a desktop that is 2592px wide, and a varying number of
pixels high :). However, I normally run the browser on the screen
with the lower resolution, so if you choose style sheet based on
screen.width, I would get the wrong one.

You cannot expect to predict the possible resolutions. There are
browsers in mobile phones these days. Some of them might reach 800
pixels width, but not all. Some 19' monitors run at 1280x1024. Some
14' monitors run at 1440x1050. The resolution doesn't tell you the
size of the pixels, only their number.

Trying to guess what a readable font is for the user, even based on
screen.width, is impossible, and bound to give problems for some
people. It is better to just stick to the user's default font size and
not try to be smart.
It isn't the user who choses the css's manually.
I was guessing a server side script, but a client side one is just as
good. In the branches that selects the style sheet, you can set a variable
to the font size that is used, so you have it for your script.
I use three css 'cause nowaday many people have screens which run over
1680.....
I would if my screen allowed it. At home I am stuck at 1600x1200
.... but I never run my browser full screen, so the resolution really
isn't important. The browser size is.
My fault, I didn't mentioned this. So that's why I found feasible a script
which swaps the size by 1 px step.


I would still let the script deciding the style also set a variable
with the original font size. Then just use a simple script similar to
the one I gave earlier to increase it in steps of one at a time.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #9
Cartel wrote:
"Randy Webb" <Hi************ @aol.com> ha scritto nel messaggio
news:Mp******** ************@co mcast.com...
Yeah, I have an idea or two. Let the user use the built-in mechanism for
adjusting font sizes. Thats what it is there for.

I've asked for ideas, not yet for "opinions".


And I gave you an idea. Its not my fault you missed the idea.
Second idea: What has my screen resolution got to do with anything? Well,
anything other than my resolution. I promise you that 600X800 on my 19"
monitor does *not* look/perform the same as 600X800 on a 15 inch monitor.
Nor does it matter when it comes to the size of my browser window. If I
have a 600x800 browser window on a 2560x960 dual monitor desktop, what in
the world makes you think I want some huge monster font on the page?

UH? Sorry..... Are you ok?


Just fine. But wondering what makes you think screen resolution has to
do with any of this.
Stop f**king with the fonts - end of problem.

Feeling lonely? Or just kinda philosophical?


Some of both, none of both, or maybe just some of none.
Some serious scripts?


If what you are wanting to do even made sense (It doesn't to me, for
many of the reasons that Lasse already pointed out) then someone would
probably have already written one.

The problem, even if you can determine the font size to start with, is
that if the user does indeed change IE settings from Medium to Largest,
then your script just got canned before it even got started. There is no
way for script to know if I did that or not.

But, you are going on the assumption that if the resolution of my
monitor is in a certain range, then I need fonts a certain size. My
point is that the screen resolution is irrelevant. And a simple scenario
can give you a good thought about it.

Right now I am sitting at a 19" dual monitor system. Now, when I sit at
my desk, I have font sizes set to small so that I don't have to read
huge letters up close. But when I start getting tired (or lazy), I back
away and recline in my desk chair. Thats after I change the font size to
Largest so I don't strain to see it anymore.

In the end, you let the user handle it and you don't have the headaches
that go along with trying to determine things like this.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3908
by: Jay Levitt | last post by:
I'm just starting to play around with CSS and MovableType. My home page (http://www.jay.fm) now validates on both the CSS and the XHTML. However, the Google cached version shows the wrong font in IE6. This seems to be because of the "header" they place before the <head> block; if I save the cached copy to disk and edit that out, it displays fine. It's not a big deal, but I don't notice this problem on other pages, so I wondered if...
258
8753
by: Terry Andersen | last post by:
If I have: struct one_{ unsigned int one_1; unsigned short one_2; unsigned short one_3; }; struct two_{ unsigned int two_1;
14
4404
by: Otto Meijer | last post by:
Hi everyone, for one of my projects I need to figure out the size of the swap file(s) of a certain system. The problem is I need to do this on a host of platforms like: HP_UX, Solaris, Linux, AIX, OSF, OpenVMS and Windows. This seems much more difficult than I thought origionaly. Some platforms don't seem to have any API to query this information.
8
4913
by: Jason Heyes | last post by:
Does the STL have a function like this one? template <typename T> void remove(std::vector<T> &v, std::vector<T>::size_type index) { std::swap(v, v.back()); v.resize(index); } Unlike std::vector::erase, it calls T::operator= only three times no matter
8
6553
by: traditore | last post by:
Hello. I'm trying to load fonts in a web page using "style" tag. The TTF files are in other page whose URL is, for example, "http://myURL/fonts". The HTML code is something like: <html> <head> <style> @font-face {
70
15063
by: axlq | last post by:
I'm trying to design my style sheets such that my pages have similar-looking fonts different platforms (Linux, Mac, Adobe, X-Windows, MS Windows, etc). The problem is, a font on one platform might be the same as a font on another platform, but with different names. I'd like to be able to specify the font names that are "most equivalent." For example, "Lucida Console" is a very attractive and readable monospaced font available in...
1
6176
by: aaron | last post by:
Output of "top" prior to initiation of mysql: load averages: 0.60, 0.97, 1.05 19:03:45 44 processes: 43 sleeping, 1 on cpu CPU states: 97.1% idle, 0.0% user, 0.8% kernel, 2.1% iowait, 0.0% swap Memory: 4096M real, 3646M free, 42M swap in use, 3494M swap free PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
19
2079
by: Viken Karaguesian | last post by:
Hello everyone, Just an observation here: the CSS newsgroup (comp.infosystems.www.authoring.stylesheets) is totally dead. Why?... Anyway here's my discussion point: What is the most versatile value to use to set font-size? I set my font size in percentages. I set the main font size in the body tag (which everything will inherit), then adjust other sizes in relation to that (for headers, fine print, etc).
11
2939
by: Dennis Jones | last post by:
Hi all, 1) Let's say you have two char 's of the same size. How would you write a no-fail swap method for them? For example: class Test { char s; void swap( Test &rhs ) {
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.