You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1177 lines
41 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file PS_plotter.cpp
  26. * @brief Kicad: specialized plotter for PS files format
  27. */
  28. #include <fctsys.h>
  29. #include <trigo.h>
  30. #include <eda_base_frame.h>
  31. #include <base_struct.h>
  32. #include <common.h>
  33. #include <plotter.h>
  34. #include <macros.h>
  35. #include <kicad_string.h>
  36. #include <convert_basic_shapes_to_polygon.h>
  37. /* Forward declaration of the font width metrics
  38. (yes extern! this is the way to forward declare variables */
  39. extern const double hv_widths[256];
  40. extern const double hvb_widths[256];
  41. extern const double hvo_widths[256];
  42. extern const double hvbo_widths[256];
  43. const double PSLIKE_PLOTTER::postscriptTextAscent = 0.718;
  44. // Common routines for Postscript-like plotting engines
  45. void PSLIKE_PLOTTER::SetDefaultLineWidth( int width )
  46. {
  47. defaultPenWidth = width;
  48. currentPenWidth = -1;
  49. }
  50. void PSLIKE_PLOTTER::SetColor( COLOR4D color )
  51. {
  52. if( colorMode )
  53. {
  54. if( negativeMode )
  55. emitSetRGBColor( 1 - color.r, 1 - color.g, 1 - color.b );
  56. else
  57. emitSetRGBColor( color.r, color.g, color.b );
  58. }
  59. else
  60. {
  61. /* B/W Mode - Use BLACK or WHITE for all items
  62. * note the 2 colors are used in B&W mode, mainly by Pcbnew to draw
  63. * holes in white on pads in black
  64. */
  65. double k = 1; // White
  66. if( color != COLOR4D::WHITE )
  67. k = 0;
  68. if( negativeMode )
  69. emitSetRGBColor( 1 - k, 1 - k, 1 - k );
  70. else
  71. emitSetRGBColor( k, k, k );
  72. }
  73. }
  74. void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize,
  75. double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData )
  76. {
  77. wxASSERT( outputFile );
  78. int x0, y0, x1, y1, delta;
  79. wxSize size( aSize );
  80. // The pad is reduced to an oval by dy > dx
  81. if( size.x > size.y )
  82. {
  83. std::swap( size.x, size.y );
  84. aPadOrient = AddAngles( aPadOrient, 900 );
  85. }
  86. delta = size.y - size.x;
  87. x0 = 0;
  88. y0 = -delta / 2;
  89. x1 = 0;
  90. y1 = delta / 2;
  91. RotatePoint( &x0, &y0, aPadOrient );
  92. RotatePoint( &x1, &y1, aPadOrient );
  93. if( aTraceMode == FILLED )
  94. ThickSegment( wxPoint( aPadPos.x + x0, aPadPos.y + y0 ),
  95. wxPoint( aPadPos.x + x1, aPadPos.y + y1 ), size.x, aTraceMode, NULL );
  96. else
  97. sketchOval( aPadPos, size, aPadOrient, -1 );
  98. }
  99. void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
  100. EDA_DRAW_MODE_T aTraceMode, void* aData )
  101. {
  102. if( aTraceMode == FILLED )
  103. Circle( aPadPos, aDiameter, FILLED_SHAPE, 0 );
  104. else // Plot a ring:
  105. {
  106. SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
  107. int linewidth = GetCurrentLineWidth();
  108. // avoid aDiameter <= 1 )
  109. if( linewidth > aDiameter-2 )
  110. linewidth = aDiameter-2;
  111. Circle( aPadPos, aDiameter - linewidth, NO_FILL, linewidth );
  112. }
  113. SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
  114. }
  115. void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
  116. double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData )
  117. {
  118. static std::vector< wxPoint > cornerList;
  119. wxSize size( aSize );
  120. cornerList.clear();
  121. if( aTraceMode == FILLED )
  122. SetCurrentLineWidth( 0 );
  123. else
  124. SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
  125. size.x -= GetCurrentLineWidth();
  126. size.y -= GetCurrentLineWidth();
  127. if( size.x < 1 )
  128. size.x = 1;
  129. if( size.y < 1 )
  130. size.y = 1;
  131. int dx = size.x / 2;
  132. int dy = size.y / 2;
  133. wxPoint corner;
  134. corner.x = aPadPos.x - dx;
  135. corner.y = aPadPos.y + dy;
  136. cornerList.push_back( corner );
  137. corner.x = aPadPos.x - dx;
  138. corner.y = aPadPos.y - dy;
  139. cornerList.push_back( corner );
  140. corner.x = aPadPos.x + dx;
  141. corner.y = aPadPos.y - dy;
  142. cornerList.push_back( corner );
  143. corner.x = aPadPos.x + dx;
  144. corner.y = aPadPos.y + dy,
  145. cornerList.push_back( corner );
  146. for( unsigned ii = 0; ii < cornerList.size(); ii++ )
  147. {
  148. RotatePoint( &cornerList[ii], aPadPos, aPadOrient );
  149. }
  150. cornerList.push_back( cornerList[0] );
  151. PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL,
  152. GetCurrentLineWidth() );
  153. }
  154. void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
  155. int aCornerRadius, double aOrient,
  156. EDA_DRAW_MODE_T aTraceMode, void* aData )
  157. {
  158. wxSize size( aSize );
  159. if( aTraceMode == FILLED )
  160. SetCurrentLineWidth( 0 );
  161. else
  162. {
  163. SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
  164. size.x -= GetCurrentLineWidth();
  165. size.y -= GetCurrentLineWidth();
  166. aCornerRadius -= GetCurrentLineWidth()/2;
  167. }
  168. SHAPE_POLY_SET outline;
  169. const int segmentToCircleCount = 64;
  170. TransformRoundChamferedRectToPolygon( outline, aPadPos, size, aOrient,
  171. aCornerRadius, 0.0, 0, segmentToCircleCount );
  172. std::vector< wxPoint > cornerList;
  173. cornerList.reserve( segmentToCircleCount + 5 );
  174. // TransformRoundRectToPolygon creates only one convex polygon
  175. SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
  176. for( int ii = 0; ii < poly.PointCount(); ++ii )
  177. cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
  178. // Close polygon
  179. cornerList.push_back( cornerList[0] );
  180. PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL,
  181. GetCurrentLineWidth() );
  182. }
  183. void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
  184. SHAPE_POLY_SET* aPolygons,
  185. EDA_DRAW_MODE_T aTraceMode, void* aData )
  186. {
  187. wxSize size( aSize );
  188. if( aTraceMode == FILLED )
  189. SetCurrentLineWidth( 0 );
  190. else
  191. {
  192. SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
  193. size.x -= GetCurrentLineWidth();
  194. size.y -= GetCurrentLineWidth();
  195. }
  196. std::vector< wxPoint > cornerList;
  197. for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
  198. {
  199. SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
  200. cornerList.clear();
  201. for( int ii = 0; ii < poly.PointCount(); ++ii )
  202. cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
  203. // Close polygon
  204. cornerList.push_back( cornerList[0] );
  205. PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL,
  206. GetCurrentLineWidth() );
  207. }
  208. }
  209. void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
  210. double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData )
  211. {
  212. static std::vector< wxPoint > cornerList;
  213. cornerList.clear();
  214. for( int ii = 0; ii < 4; ii++ )
  215. cornerList.push_back( aCorners[ii] );
  216. if( aTraceMode == FILLED )
  217. {
  218. SetCurrentLineWidth( 0 );
  219. }
  220. else
  221. {
  222. SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
  223. int w = GetCurrentLineWidth();
  224. // offset polygon by w
  225. // coord[0] is assumed the lower left
  226. // coord[1] is assumed the upper left
  227. // coord[2] is assumed the upper right
  228. // coord[3] is assumed the lower right
  229. /* Trace the outline. */
  230. cornerList[0].x += w;
  231. cornerList[0].y -= w;
  232. cornerList[1].x += w;
  233. cornerList[1].y += w;
  234. cornerList[2].x -= w;
  235. cornerList[2].y += w;
  236. cornerList[3].x -= w;
  237. cornerList[3].y -= w;
  238. }
  239. for( int ii = 0; ii < 4; ii++ )
  240. {
  241. RotatePoint( &cornerList[ii], aPadOrient );
  242. cornerList[ii] += aPadPos;
  243. }
  244. cornerList.push_back( cornerList[0] );
  245. PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL,
  246. GetCurrentLineWidth() );
  247. }
  248. /**
  249. * Write on a stream a string escaped for postscript/PDF
  250. */
  251. void PSLIKE_PLOTTER::fputsPostscriptString(FILE *fout, const wxString& txt)
  252. {
  253. putc( '(', fout );
  254. for( unsigned i = 0; i < txt.length(); i++ )
  255. {
  256. // Lazyness made me use stdio buffering yet another time...
  257. wchar_t ch = txt[i];
  258. if( ch < 256 )
  259. {
  260. switch (ch)
  261. {
  262. // The ~ shouldn't reach the outside
  263. case '~':
  264. break;
  265. // These characters must be escaped
  266. case '(':
  267. case ')':
  268. case '\\':
  269. putc( '\\', fout );
  270. // FALLTHRU
  271. default:
  272. putc( ch, fout );
  273. break;
  274. }
  275. }
  276. }
  277. putc( ')', fout );
  278. }
  279. /**
  280. * Sister function for the GraphicTextWidth in drawtxt.cpp
  281. * Does the same processing (i.e. calculates a text string width) but
  282. * using postscript metrics for the Helvetica font (optionally used for
  283. * PS and PDF plotting
  284. */
  285. int PSLIKE_PLOTTER::returnPostscriptTextWidth( const wxString& aText, int aXSize,
  286. bool aItalic, bool aBold )
  287. {
  288. const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
  289. : ( aItalic ? hvo_widths : hv_widths );
  290. double tally = 0;
  291. for( unsigned i = 0; i < aText.length(); i++ )
  292. {
  293. wchar_t AsciiCode = aText[i];
  294. // Skip the negation marks and untabled points
  295. if( AsciiCode != '~' && AsciiCode < 256 )
  296. {
  297. tally += width_table[AsciiCode];
  298. }
  299. }
  300. // Widths are proportional to height, but height is enlarged by a
  301. // scaling factor
  302. return KiROUND( aXSize * tally / postscriptTextAscent );
  303. }
  304. /**
  305. * Computes the x coordinates for the overlining in a string of text.
  306. * Fills the passed vector with couples of (start, stop) values to be
  307. * used in the text coordinate system (use computeTextParameters to
  308. * obtain the parameters to estabilish such a system)
  309. */
  310. void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXSize,
  311. bool aItalic, bool aBold,
  312. std::vector<int> *pos_pairs )
  313. {
  314. /* XXX This function is *too* similar to returnPostscriptTextWidth.
  315. Consider merging them... */
  316. const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
  317. : ( aItalic ? hvo_widths : hv_widths );
  318. double tally = 0;
  319. for( unsigned i = 0; i < aText.length(); i++ )
  320. {
  321. wchar_t AsciiCode = aText[i];
  322. // Skip the negation marks and untabled points
  323. if( AsciiCode != '~' && AsciiCode < 256 )
  324. {
  325. tally += width_table[AsciiCode];
  326. }
  327. else
  328. {
  329. if( AsciiCode == '~' )
  330. pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
  331. }
  332. }
  333. // Special rule: we have to complete the last bar if the ~ aren't matched
  334. if( pos_pairs->size() % 2 == 1 )
  335. pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
  336. }
  337. void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
  338. double aScale, bool aMirror )
  339. {
  340. wxASSERT( !outputFile );
  341. m_plotMirror = aMirror;
  342. plotOffset = aOffset;
  343. plotScale = aScale;
  344. m_IUsPerDecimil = aIusPerDecimil;
  345. iuPerDeviceUnit = 1.0 / aIusPerDecimil;
  346. /* Compute the paper size in IUs */
  347. paperSize = pageInfo.GetSizeMils();
  348. paperSize.x *= 10.0 * aIusPerDecimil;
  349. paperSize.y *= 10.0 * aIusPerDecimil;
  350. SetDefaultLineWidth( 100 * aIusPerDecimil ); // arbitrary default
  351. }
  352. /** This is the core for postscript/PDF text alignment
  353. * It computes the transformation matrix to generate a user space
  354. * system aligned with the text. Even the PS uses the concat
  355. * operator to simplify PDF generation (concat is everything PDF
  356. * has to modify the CTM. Lots of parameters, both in and out.
  357. */
  358. void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
  359. const wxString& aText,
  360. int aOrient,
  361. const wxSize& aSize,
  362. bool aMirror,
  363. enum EDA_TEXT_HJUSTIFY_T aH_justify,
  364. enum EDA_TEXT_VJUSTIFY_T aV_justify,
  365. int aWidth,
  366. bool aItalic,
  367. bool aBold,
  368. double *wideningFactor,
  369. double *ctm_a,
  370. double *ctm_b,
  371. double *ctm_c,
  372. double *ctm_d,
  373. double *ctm_e,
  374. double *ctm_f,
  375. double *heightFactor )
  376. {
  377. // Compute the starting position (compensated for alignment)
  378. wxPoint start_pos = aPos;
  379. // This is an approximation of the text bounds (in IUs)
  380. int tw = returnPostscriptTextWidth( aText, aSize.x, aItalic, aWidth );
  381. int th = aSize.y;
  382. int dx, dy;
  383. switch( aH_justify )
  384. {
  385. case GR_TEXT_HJUSTIFY_CENTER:
  386. dx = -tw / 2;
  387. break;
  388. case GR_TEXT_HJUSTIFY_RIGHT:
  389. dx = -tw;
  390. break;
  391. case GR_TEXT_HJUSTIFY_LEFT:
  392. dx = 0;
  393. break;
  394. }
  395. switch( aV_justify )
  396. {
  397. case GR_TEXT_VJUSTIFY_CENTER:
  398. dy = th / 2;
  399. break;
  400. case GR_TEXT_VJUSTIFY_TOP:
  401. dy = th;
  402. break;
  403. case GR_TEXT_VJUSTIFY_BOTTOM:
  404. dy = 0;
  405. break;
  406. }
  407. RotatePoint( &dx, &dy, aOrient );
  408. RotatePoint( &tw, &th, aOrient );
  409. start_pos.x += dx;
  410. start_pos.y += dy;
  411. DPOINT pos_dev = userToDeviceCoordinates( start_pos );
  412. DPOINT sz_dev = userToDeviceSize( aSize );
  413. // Now returns the final values... the widening factor
  414. *wideningFactor = sz_dev.x / sz_dev.y;
  415. // Mirrored texts must be plotted as mirrored!
  416. if( m_plotMirror )
  417. {
  418. *wideningFactor = -*wideningFactor;
  419. aOrient = -aOrient;
  420. }
  421. // The CTM transformation matrix
  422. double alpha = DECIDEG2RAD( aOrient );
  423. double sinalpha = sin( alpha );
  424. double cosalpha = cos( alpha );
  425. *ctm_a = cosalpha;
  426. *ctm_b = sinalpha;
  427. *ctm_c = -sinalpha;
  428. *ctm_d = cosalpha;
  429. *ctm_e = pos_dev.x;
  430. *ctm_f = pos_dev.y;
  431. // This is because the letters are less than 1 unit high
  432. *heightFactor = sz_dev.y / postscriptTextAscent;
  433. }
  434. /* Set the current line width (in IUs) for the next plot
  435. */
  436. void PS_PLOTTER::SetCurrentLineWidth( int width, void* aData )
  437. {
  438. wxASSERT( outputFile );
  439. int pen_width;
  440. if( width >= 0 )
  441. pen_width = width;
  442. else
  443. pen_width = defaultPenWidth;
  444. if( pen_width != GetCurrentLineWidth() )
  445. fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( pen_width ) );
  446. currentPenWidth = pen_width;
  447. }
  448. void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
  449. {
  450. wxASSERT( outputFile );
  451. // XXX why %.3g ? shouldn't %g suffice? who cares...
  452. fprintf( outputFile, "%.3g %.3g %.3g setrgbcolor\n", r, g, b );
  453. }
  454. /**
  455. * Postscript supports dashed lines
  456. */
  457. void PS_PLOTTER::SetDash( int dashed )
  458. {
  459. switch( dashed )
  460. {
  461. case PLOTDASHTYPE_DASH:
  462. fprintf( outputFile, "[%d %d] 0 setdash\n",
  463. (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
  464. break;
  465. case PLOTDASHTYPE_DOT:
  466. fprintf( outputFile, "[%d %d] 0 setdash\n",
  467. (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
  468. break;
  469. case PLOTDASHTYPE_DASHDOT:
  470. fprintf( outputFile, "[%d %d %d %d] 0 setdash\n",
  471. (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
  472. (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
  473. break;
  474. default:
  475. fputs( "solidline\n", outputFile );
  476. }
  477. }
  478. void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
  479. {
  480. DPOINT p1_dev = userToDeviceCoordinates( p1 );
  481. DPOINT p2_dev = userToDeviceCoordinates( p2 );
  482. SetCurrentLineWidth( width );
  483. fprintf( outputFile, "%g %g %g %g rect%d\n", p1_dev.x, p1_dev.y,
  484. p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, fill );
  485. }
  486. void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width )
  487. {
  488. wxASSERT( outputFile );
  489. DPOINT pos_dev = userToDeviceCoordinates( pos );
  490. double radius = userToDeviceSize( diametre / 2.0 );
  491. SetCurrentLineWidth( width );
  492. fprintf( outputFile, "%g %g %g cir%d\n", pos_dev.x, pos_dev.y, radius, fill );
  493. }
  494. void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
  495. int radius, FILL_T fill, int width )
  496. {
  497. wxASSERT( outputFile );
  498. if( radius <= 0 )
  499. return;
  500. if( StAngle > EndAngle )
  501. std::swap( StAngle, EndAngle );
  502. SetCurrentLineWidth( width );
  503. // Calculate start point.
  504. DPOINT centre_dev = userToDeviceCoordinates( centre );
  505. double radius_dev = userToDeviceSize( radius );
  506. if( m_plotMirror )
  507. {
  508. if( m_mirrorIsHorizontal )
  509. {
  510. StAngle = 1800.0 -StAngle;
  511. EndAngle = 1800.0 -EndAngle;
  512. std::swap( StAngle, EndAngle );
  513. }
  514. else
  515. {
  516. StAngle = -StAngle;
  517. EndAngle = -EndAngle;
  518. }
  519. }
  520. fprintf( outputFile, "%g %g %g %g %g arc%d\n", centre_dev.x, centre_dev.y,
  521. radius_dev, StAngle / 10.0, EndAngle / 10.0, fill );
  522. }
  523. void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
  524. FILL_T aFill, int aWidth, void * aData )
  525. {
  526. if( aCornerList.size() <= 1 )
  527. return;
  528. SetCurrentLineWidth( aWidth );
  529. DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
  530. fprintf( outputFile, "newpath\n%g %g moveto\n", pos.x, pos.y );
  531. for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
  532. {
  533. pos = userToDeviceCoordinates( aCornerList[ii] );
  534. fprintf( outputFile, "%g %g lineto\n", pos.x, pos.y );
  535. }
  536. // Close/(fill) the path
  537. fprintf( outputFile, "poly%d\n", aFill );
  538. }
  539. /**
  540. * Postscript-likes at the moment are the only plot engines supporting bitmaps...
  541. */
  542. void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
  543. double aScaleFactor )
  544. {
  545. wxSize pix_size; // size of the bitmap in pixels
  546. pix_size.x = aImage.GetWidth();
  547. pix_size.y = aImage.GetHeight();
  548. DPOINT drawsize( aScaleFactor * pix_size.x,
  549. aScaleFactor * pix_size.y ); // requested size of image
  550. // calculate the bottom left corner position of bitmap
  551. wxPoint start = aPos;
  552. start.x -= drawsize.x / 2; // left
  553. start.y += drawsize.y / 2; // bottom (Y axis reversed)
  554. // calculate the top right corner position of bitmap
  555. wxPoint end;
  556. end.x = start.x + drawsize.x;
  557. end.y = start.y - drawsize.y;
  558. fprintf( outputFile, "/origstate save def\n" );
  559. fprintf( outputFile, "/pix %d string def\n", pix_size.x );
  560. // Locate lower-left corner of image
  561. DPOINT start_dev = userToDeviceCoordinates( start );
  562. fprintf( outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
  563. // Map image size to device
  564. DPOINT end_dev = userToDeviceCoordinates( end );
  565. fprintf( outputFile, "%g %g scale\n",
  566. std::abs(end_dev.x - start_dev.x), std::abs(end_dev.y - start_dev.y));
  567. // Dimensions of source image (in pixels
  568. fprintf( outputFile, "%d %d 8", pix_size.x, pix_size.y );
  569. // Map unit square to source
  570. fprintf( outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
  571. // include image data in ps file
  572. fprintf( outputFile, "{currentfile pix readhexstring pop}\n" );
  573. if( colorMode )
  574. fputs( "false 3 colorimage\n", outputFile );
  575. else
  576. fputs( "image\n", outputFile );
  577. // Single data source, 3 colors, Output RGB data (hexadecimal)
  578. // (or the same downscaled to gray)
  579. int jj = 0;
  580. for( int yy = 0; yy < pix_size.y; yy ++ )
  581. {
  582. for( int xx = 0; xx < pix_size.x; xx++, jj++ )
  583. {
  584. if( jj >= 16 )
  585. {
  586. jj = 0;
  587. fprintf( outputFile, "\n");
  588. }
  589. int red, green, blue;
  590. red = aImage.GetRed( xx, yy) & 0xFF;
  591. green = aImage.GetGreen( xx, yy) & 0xFF;
  592. blue = aImage.GetBlue( xx, yy) & 0xFF;
  593. if( colorMode )
  594. fprintf( outputFile, "%2.2X%2.2X%2.2X", red, green, blue );
  595. else
  596. fprintf( outputFile, "%2.2X", (red + green + blue) / 3 );
  597. }
  598. }
  599. fprintf( outputFile, "\n");
  600. fprintf( outputFile, "origstate restore\n" );
  601. }
  602. void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
  603. {
  604. wxASSERT( outputFile );
  605. if( plume == 'Z' )
  606. {
  607. if( penState != 'Z' )
  608. {
  609. fputs( "stroke\n", outputFile );
  610. penState = 'Z';
  611. penLastpos.x = -1;
  612. penLastpos.y = -1;
  613. }
  614. return;
  615. }
  616. if( penState == 'Z' )
  617. {
  618. fputs( "newpath\n", outputFile );
  619. }
  620. if( penState != plume || pos != penLastpos )
  621. {
  622. DPOINT pos_dev = userToDeviceCoordinates( pos );
  623. fprintf( outputFile, "%g %g %sto\n",
  624. pos_dev.x, pos_dev.y,
  625. ( plume=='D' ) ? "line" : "move" );
  626. }
  627. penState = plume;
  628. penLastpos = pos;
  629. }
  630. /**
  631. * The code within this function (and the CloseFilePS function)
  632. * creates postscript files whose contents comply with Adobe's
  633. * Document Structuring Convention, as documented by assorted
  634. * details described within the following URLs:
  635. *
  636. * http://en.wikipedia.org/wiki/Document_Structuring_Conventions
  637. * http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf
  638. *
  639. *
  640. * BBox is the boundary box (position and size of the "client rectangle"
  641. * for drawings (page - margins) in mils (0.001 inch)
  642. */
  643. bool PS_PLOTTER::StartPlot()
  644. {
  645. wxASSERT( outputFile );
  646. wxString msg;
  647. static const char* PSMacro[] =
  648. {
  649. "%%BeginProlog\n",
  650. "/line { newpath moveto lineto stroke } bind def\n",
  651. "/cir0 { newpath 0 360 arc stroke } bind def\n",
  652. "/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
  653. "/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
  654. "/arc0 { newpath arc stroke } bind def\n",
  655. "/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
  656. " grestore stroke } bind def\n",
  657. "/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
  658. " grestore stroke } bind def\n",
  659. "/poly0 { stroke } bind def\n",
  660. "/poly1 { closepath gsave fill grestore stroke } bind def\n",
  661. "/poly2 { closepath gsave fill grestore stroke } bind def\n",
  662. "/rect0 { rectstroke } bind def\n",
  663. "/rect1 { rectfill } bind def\n",
  664. "/rect2 { rectfill } bind def\n",
  665. "/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
  666. "/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
  667. "/dashedline { [200] 100 setdash } bind def\n",
  668. "/solidline { [] 0 setdash } bind def\n",
  669. // This is for 'hidden' text (search anchors for PDF)
  670. "/phantomshow { moveto\n",
  671. " /KicadFont findfont 0.000001 scalefont setfont\n",
  672. " show } bind def\n",
  673. // This is for regular postscript text
  674. "/textshow { gsave\n",
  675. " findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n",
  676. " } bind def\n",
  677. // Utility for getting Latin1 encoded fonts
  678. "/reencodefont {\n",
  679. " findfont dup length dict begin\n",
  680. " { 1 index /FID ne\n",
  681. " { def }\n",
  682. " { pop pop } ifelse\n",
  683. " } forall\n",
  684. " /Encoding ISOLatin1Encoding def\n",
  685. " currentdict\n",
  686. " end } bind def\n"
  687. // Remap AdobeStandard fonts to Latin1
  688. "/KicadFont /Helvetica reencodefont definefont pop\n",
  689. "/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
  690. "/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
  691. "/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
  692. "%%EndProlog\n",
  693. NULL
  694. };
  695. time_t time1970 = time( NULL );
  696. fputs( "%!PS-Adobe-3.0\n", outputFile ); // Print header
  697. fprintf( outputFile, "%%%%Creator: %s\n", TO_UTF8( creator ) );
  698. /* A "newline" character ("\n") is not included in the following string,
  699. because it is provided by the ctime() function. */
  700. fprintf( outputFile, "%%%%CreationDate: %s", ctime( &time1970 ) );
  701. fprintf( outputFile, "%%%%Title: %s\n", TO_UTF8( filename ) );
  702. fprintf( outputFile, "%%%%Pages: 1\n" );
  703. fprintf( outputFile, "%%%%PageOrder: Ascend\n" );
  704. // Print boundary box in 1/72 pixels per inch, box is in mils
  705. const double BIGPTsPERMIL = 0.072;
  706. /* The coordinates of the lower left corner of the boundary
  707. box need to be "rounded down", but the coordinates of its
  708. upper right corner need to be "rounded up" instead. */
  709. wxSize psPaperSize = pageInfo.GetSizeMils();
  710. if( !pageInfo.IsPortrait() )
  711. psPaperSize.Set( pageInfo.GetHeightMils(), pageInfo.GetWidthMils() );
  712. fprintf( outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
  713. (int) ceil( psPaperSize.x * BIGPTsPERMIL ),
  714. (int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
  715. // Specify the size of the sheet and the name associated with that size.
  716. // (If the "User size" option has been selected for the sheet size,
  717. // identify the sheet size as "Custom" (rather than as "User"), but
  718. // otherwise use the name assigned by KiCad for each sheet size.)
  719. //
  720. // (The Document Structuring Convention also supports sheet weight,
  721. // sheet color, and sheet type properties being specified within a
  722. // %%DocumentMedia comment, but they are not being specified here;
  723. // a zero and two null strings are subsequently provided instead.)
  724. //
  725. // (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
  726. // the order in which they are specified is not wrong!)
  727. // Also note pageSize is given in mils, not in internal units and must be
  728. // converted to internal units.
  729. if( pageInfo.IsCustom() )
  730. fprintf( outputFile, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
  731. KiROUND( psPaperSize.x * BIGPTsPERMIL ),
  732. KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
  733. else // a standard paper size
  734. fprintf( outputFile, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
  735. TO_UTF8( pageInfo.GetType() ),
  736. KiROUND( psPaperSize.x * BIGPTsPERMIL ),
  737. KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
  738. if( pageInfo.IsPortrait() )
  739. fprintf( outputFile, "%%%%Orientation: Portrait\n" );
  740. else
  741. fprintf( outputFile, "%%%%Orientation: Landscape\n" );
  742. fprintf( outputFile, "%%%%EndComments\n" );
  743. // Now specify various other details.
  744. for( int ii = 0; PSMacro[ii] != NULL; ii++ )
  745. {
  746. fputs( PSMacro[ii], outputFile );
  747. }
  748. // The following string has been specified here (rather than within
  749. // PSMacro[]) to highlight that it has been provided to ensure that the
  750. // contents of the postscript file comply with the details specified
  751. // within the Document Structuring Convention.
  752. fputs( "%%Page: 1 1\n"
  753. "%%BeginPageSetup\n"
  754. "gsave\n"
  755. "0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
  756. "linemode1\n", outputFile );
  757. // Rototranslate the coordinate to achieve the landscape layout
  758. if( !pageInfo.IsPortrait() )
  759. fprintf( outputFile, "%d 0 translate 90 rotate\n", 10 * psPaperSize.x );
  760. // Apply the user fine scale adjustments
  761. if( plotScaleAdjX != 1.0 || plotScaleAdjY != 1.0 )
  762. fprintf( outputFile, "%g %g scale\n",
  763. plotScaleAdjX, plotScaleAdjY );
  764. // Set default line width
  765. fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( defaultPenWidth ) );
  766. fputs( "%%EndPageSetup\n", outputFile );
  767. return true;
  768. }
  769. bool PS_PLOTTER::EndPlot()
  770. {
  771. wxASSERT( outputFile );
  772. fputs( "showpage\n"
  773. "grestore\n"
  774. "%%EOF\n", outputFile );
  775. fclose( outputFile );
  776. outputFile = NULL;
  777. return true;
  778. }
  779. void PS_PLOTTER::Text( const wxPoint& aPos,
  780. const COLOR4D aColor,
  781. const wxString& aText,
  782. double aOrient,
  783. const wxSize& aSize,
  784. enum EDA_TEXT_HJUSTIFY_T aH_justify,
  785. enum EDA_TEXT_VJUSTIFY_T aV_justify,
  786. int aWidth,
  787. bool aItalic,
  788. bool aBold,
  789. bool aMultilineAllowed,
  790. void* aData )
  791. {
  792. SetCurrentLineWidth( aWidth );
  793. SetColor( aColor );
  794. // Fix me: see how to use PS text mode for multiline texts
  795. if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
  796. aMultilineAllowed = false; // the text has only one line.
  797. // Draw the native postscript text (if requested)
  798. // Currently: does not work: disable it
  799. bool use_native = false; // = m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed;
  800. if( use_native )
  801. {
  802. const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique"
  803. : "/KicadFont-Oblique")
  804. : (aBold ? "/KicadFont-Bold"
  805. : "/KicadFont");
  806. // Compute the copious tranformation parameters
  807. double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
  808. double wideningFactor, heightFactor;
  809. computeTextParameters( aPos, aText, aOrient, aSize, m_plotMirror, aH_justify,
  810. aV_justify, aWidth, aItalic, aBold,
  811. &wideningFactor, &ctm_a, &ctm_b, &ctm_c,
  812. &ctm_d, &ctm_e, &ctm_f, &heightFactor );
  813. // The text must be escaped correctly, the others are the various
  814. // parameters. The CTM is formatted with %f since sin/cos tends
  815. // to make %g use exponential notation (which is not supported)
  816. fputsPostscriptString( outputFile, aText );
  817. fprintf( outputFile, " %g [%f %f %f %f %f %f] %g %s textshow\n",
  818. wideningFactor, ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f,
  819. heightFactor, fontname );
  820. /* The textshow operator retained the coordinate system, we use it
  821. * to plot the overbars. See the PDF sister function for more
  822. * details */
  823. std::vector<int> pos_pairs;
  824. postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs );
  825. int overbar_y = KiROUND( aSize.y * 1.1 );
  826. for( unsigned i = 0; i < pos_pairs.size(); i += 2)
  827. {
  828. DPOINT dev_from = userToDeviceSize( wxSize( pos_pairs[i], overbar_y ) );
  829. DPOINT dev_to = userToDeviceSize( wxSize( pos_pairs[i + 1], overbar_y ) );
  830. fprintf( outputFile, "%g %g %g %g line ",
  831. dev_from.x, dev_from.y, dev_to.x, dev_to.y );
  832. }
  833. // Restore the CTM
  834. fputs( "grestore\n", outputFile );
  835. }
  836. // Draw the hidden postscript text (if requested)
  837. if( m_textMode == PLOTTEXTMODE_PHANTOM )
  838. {
  839. fputsPostscriptString( outputFile, aText );
  840. DPOINT pos_dev = userToDeviceCoordinates( aPos );
  841. fprintf( outputFile, " %g %g phantomshow\n", pos_dev.x, pos_dev.y );
  842. }
  843. // Draw the stroked text (if requested)
  844. if( !use_native )
  845. {
  846. PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
  847. aWidth, aItalic, aBold, aMultilineAllowed );
  848. }
  849. }
  850. /**
  851. * Character widths for Helvetica
  852. */
  853. const double hv_widths[256] = {
  854. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  855. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  856. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  857. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  858. 0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
  859. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  860. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  861. 0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
  862. 1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
  863. 0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
  864. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  865. 0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
  866. 0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
  867. 0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
  868. 0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
  869. 0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
  870. 0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
  871. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  872. 0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
  873. 0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
  874. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
  875. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  876. 0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
  877. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  878. 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
  879. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  880. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  881. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  882. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
  883. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  884. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
  885. 0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
  886. };
  887. /**
  888. * Character widths for Helvetica-Bold
  889. */
  890. const double hvb_widths[256] = {
  891. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  892. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  893. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  894. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  895. 0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
  896. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  897. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  898. 0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
  899. 0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
  900. 0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
  901. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  902. 0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
  903. 0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
  904. 0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
  905. 0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
  906. 0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
  907. 0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
  908. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  909. 0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
  910. 0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
  911. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
  912. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  913. 0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
  914. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  915. 0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
  916. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  917. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  918. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  919. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
  920. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  921. 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
  922. 0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
  923. };
  924. /**
  925. * Character widths for Helvetica-Oblique
  926. */
  927. const double hvo_widths[256] = {
  928. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  929. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  930. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  931. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  932. 0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
  933. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  934. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  935. 0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
  936. 1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
  937. 0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
  938. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  939. 0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
  940. 0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
  941. 0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
  942. 0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
  943. 0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
  944. 0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
  945. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  946. 0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
  947. 0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
  948. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
  949. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  950. 0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
  951. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  952. 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
  953. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  954. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  955. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  956. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
  957. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  958. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
  959. 0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
  960. };
  961. /**
  962. * Character widths for Helvetica-BoldOblique
  963. */
  964. const double hvbo_widths[256] = {
  965. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  966. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  967. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  968. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  969. 0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
  970. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  971. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  972. 0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
  973. 0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
  974. 0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
  975. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  976. 0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
  977. 0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
  978. 0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
  979. 0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
  980. 0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
  981. 0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
  982. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  983. 0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
  984. 0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
  985. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
  986. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  987. 0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
  988. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  989. 0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
  990. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  991. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  992. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  993. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
  994. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  995. 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
  996. 0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
  997. };