[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (2d21a8ad8f38e07b17450450a096f1ce4b3bef0e)



The branch, master has been updated
       via  2d21a8ad8f38e07b17450450a096f1ce4b3bef0e (commit)
      from  d2458383a60b670ad1c42163ac24fcc63fcab457 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/change.c |    8 ++++----
 src/draw.c   |    4 ++--
 src/report.c |    4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)


=================
 Commit Messages
=================

commit 2d21a8ad8f38e07b17450450a096f1ce4b3bef0e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Fix some text scale factors
    
    This commit fixes pin / pad name drawing, the pinout preview and
    two actions which change the size of text based on user input.
    
    To recap:
    
    Text->Scale is a percentage scaling (from the font definition). The
    default font has has an approximate cap-height of 45-50 mils, and PCB
    assumes this to be the case.
    
    Text->Scale is not a Coord, it is an integer, so use int as the resulting
    type for any calculations involving this number. (100% is stored as 100
    in Text->scale). Code which scales text based upon other object sizes does
    so by dividing to a dimensionless scale factor. We may have to be careful
    about the width of intermediate results when scaling based on Coords if
    Coord is changed to 64bit at some point.
    
    ChangeTextSize() and ChangeElementNameSize accept absolute (or delta)
    sizes in units of distance. These are converted to a Scale by
    assuming a 100% scaled font is 45mils high. YMMV.
    
    Oh - and just to note.. the line-thickness is drawn at half the width
    stored in the font definition. This is clearly bonkers, but we would
    break designs if we changed it now. Grr.
    (Thanks a bunch commit 66592387176ba2578dfc14023a6fe49226f3a3df).

:100644 100644 fb6e62c... 97154fd... M	src/change.c
:100644 100644 8950539... 1315707... M	src/draw.c
:100644 100644 56e9be4... deb6095... M	src/report.c

=========
 Changes
=========

commit 2d21a8ad8f38e07b17450450a096f1ce4b3bef0e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Fix some text scale factors
    
    This commit fixes pin / pad name drawing, the pinout preview and
    two actions which change the size of text based on user input.
    
    To recap:
    
    Text->Scale is a percentage scaling (from the font definition). The
    default font has has an approximate cap-height of 45-50 mils, and PCB
    assumes this to be the case.
    
    Text->Scale is not a Coord, it is an integer, so use int as the resulting
    type for any calculations involving this number. (100% is stored as 100
    in Text->scale). Code which scales text based upon other object sizes does
    so by dividing to a dimensionless scale factor. We may have to be careful
    about the width of intermediate results when scaling based on Coords if
    Coord is changed to 64bit at some point.
    
    ChangeTextSize() and ChangeElementNameSize accept absolute (or delta)
    sizes in units of distance. These are converted to a Scale by
    assuming a 100% scaled font is 45mils high. YMMV.
    
    Oh - and just to note.. the line-thickness is drawn at half the width
    stored in the font definition. This is clearly bonkers, but we would
    break designs if we changed it now. Grr.
    (Thanks a bunch commit 66592387176ba2578dfc14023a6fe49226f3a3df).

diff --git a/src/change.c b/src/change.c
index fb6e62c..97154fd 100644
--- a/src/change.c
+++ b/src/change.c
@@ -838,7 +838,8 @@ ChangeArcClearSize (LayerTypePtr Layer, ArcTypePtr Arc)
 static void *
 ChangeTextSize (LayerTypePtr Layer, TextTypePtr Text)
 {
-  Coord value = (Absolute) ? Absolute / 45 : Text->Scale + Delta / 45;
+  int value = (Absolute != 0 ? Text->Scale : 0) +
+              (Absolute != 0 ? Absolute : Delta) * 100 / MIL_TO_COORD (45);
 
   if (TEST_FLAG (LOCKFLAG, Text))
     return (NULL);
@@ -913,9 +914,8 @@ ChangeElementSize (ElementTypePtr Element)
 static void *
 ChangeElementNameSize (ElementTypePtr Element)
 {
-  Coord value =
-    (Absolute) ? Absolute / 45 : DESCRIPTION_TEXT (Element).Scale +
-    Delta / 45;
+  int value = (Absolute != 0 ? DESCRIPTION_TEXT (Element).Scale : 0) +
+              (Absolute != 0 ? Absolute : Delta) * 100 / MIL_TO_COORD (45);
 
   if (TEST_FLAG (LOCKFLAG, &Element->Name[0]))
     return (NULL);
diff --git a/src/draw.c b/src/draw.c
index 8950539..1315707 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -199,7 +199,7 @@ _draw_pv_name (PinType *pv)
   gui->set_color (Output.fgGC, PCB->PinNameColor);
 
   text.Flags = NoFlags ();
-  text.Scale = pv->Thickness / 80;
+  text.Scale = 100 * pv->Thickness / MIL_TO_COORD (80);
   text.X = box.X1;
   text.Y = box.Y1;
   text.Direction = vert ? 1 : 0;
@@ -284,7 +284,7 @@ draw_pad_name (PadType *pad)
   gui->set_color (Output.fgGC, PCB->PinNameColor);
 
   text.Flags = NoFlags ();
-  text.Scale = pad->Thickness / 50;
+  text.Scale = 100 * pad->Thickness / MIL_TO_COORD (50);
   text.X = box.X1;
   text.Y = box.Y1;
   text.Direction = vert ? 1 : 0;
diff --git a/src/report.c b/src/report.c
index 56e9be4..deb6095 100644
--- a/src/report.c
+++ b/src/report.c
@@ -423,7 +423,7 @@ ReportDialog (int argc, char **argv, Coord x, Coord y)
 		 EMPTY (element->Name[0].TextString),
 		 EMPTY (element->Name[1].TextString),
 		 EMPTY (element->Name[2].TextString),
-		 (Coord) (0.45 * element->Name[1].Scale * 100),
+		 (Coord) (MIL_TO_COORD (45) * element->Name[1].Scale / 100.),
 		 element->Name[1].X, element->Name[1].Y,
 		 TEST_FLAG (HIDENAMEFLAG, element) ? ",\n  but it's hidden" : "",
 		 element->MarkX, element->MarkY,
@@ -464,7 +464,7 @@ ReportDialog (int argc, char **argv, Coord x, Coord y)
 		 "The bounding box is %$mD %$mD.\n"
 		 "%s\n"
 		 "%s", USER_UNITMASK, text->ID, flags_to_string (text->Flags, TEXT_TYPE),
-		 text->X, text->Y, (Coord) (0.45 * MIL_TO_COORD (text->Scale)),
+		 text->X, text->Y, (Coord) (MIL_TO_COORD (45) * (float)text->Scale / 100.),
 		 text->TextString, text->Direction,
 		 text->BoundingBox.X1, text->BoundingBox.Y1,
 		 text->BoundingBox.X2, text->BoundingBox.Y2,




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs